hello, i am trying to parse an html do***ent for links for output, my
idea is to grab the URL from a form and send the URL to another file
that does the actual parse process. i am aware that HTML:Parser has a
built in for this, but i want to learn regex better. my plan after i
get the file is to put the new varaible into a loop construct and use
a regex cpmparitor to put a match into an array. the only problem is
that i dont know how to setup such a loop and grab the whole "piece"
of what i need. i have included some code that i have made. i would
appreciate any help given. thank you
#!/usr/local/bin/perl
use CGI ':standard';
use LWP::Simple;
##Declare globals -----------------------------------
$url = "http://www.yahoo.com";
$linkstring = "http://";
$imagestring = ".gif";
my $content = get $url;
die "Couldn't get $url" unless defined $content;
#---------------------------------------------------
print header, start_html({-title =>'Your Results'});
if($content =~ m/$linkstring/i) {
$var = m/$linkstring/i;
print "$var\n";
} else {
print "No\n";
}
if($content =~ m/$imagestring/i) {
print "Yes\n";
} else {
print "No\n";
}
print end_html;