i need help to filter result in $link that i need to receive url like : "http://website/Registration.aspx?returnUrl= " all another urls need be deleted. my perl script: #!/usr/bin/perl -w use HTML::LinkExtor; use Data::Dumper; $content=0;$line=0; open(SALES,"email.txt"); while ($line= <SALES>) { $content= $line.$content; } close SALES; my $parser = HTML::LinkExtor->new(); #create LinkExtor object with no callbacks $parser->parse($content); #parse content my @links = $parser->links; #get list of links print Dumper \@links; #print list of links out. Code (markup):
As with perl, there is more than one way to do it..... a regex inline would be simple enough but depends on what you are doing with the urls afterwards. #!/usr/bin/perl -w use HTML::LinkExtor; use Data::Dumper; $content=0;$line=0; my $url ="http://website/Registration.aspx?returnUrl="; open(SALES,"email.txt"); while ($line= <SALES>) { $content= $line.$content; } close SALES; my $parser = HTML::LinkExtor->new(); #create LinkExtor object with no callbacks $parser->parse($content); #parse content my @links = $parser->links; #get list of links foreach my $link (@links) { if(index($url, $link)) { print "success\n"; } } Code (markup): By the way, you should really "use strict" too.