On Tue, 2002-01-15 at 01:44, Lorne Easton wrote:
> I need to write some code that extracts that extracts hyperlinks from a
> scalar ($data) and puts them into an array.
> 
> I imagine that grep can do this, but my mastery of it and
> reqular expressions are not brilliant.
> 
> Can you please provide some example code, or at least point me in the right
> direction?
> 
> Cheers,
> Lorne

This bit of my script does what you want

#!/usr/bin/perl -w
use locale;

my @list1=`grep 'HREF.*.html' $ARGV[0]`;

foreach $list1 (@list1){
$list1=~s/HREF="/\n/gi ;
$list1=~s/(\#.*\n)//gi ;# strip name refs
$list1=~s/"//gi ;

foreach $list1 (@list1){
%seen =();
@list3 = grep{ ! $seen{$_} ++ } @list1;# dedupe
}

However the script continues
print @list3;
my $var1='META';
@lista= grep{$var1} @list3;## not picked up at all
print @lista

anyone any clues


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to