Gossamer Forum
Home : General : Perl Programming :

Question about LWP

Quote Reply
Question about LWP
I am using an Perl Script that uses LWP. I want to know how to capture ONLY the first FOUR links of this page. Here is the script I'm using, please tell me what I need to add:

Code:
#!/usr/local/bin/perl
use LWP::Simple;
#retrieve the page which should be modified
my $page = get("http://www.site.com");
$page =~ s/\n//g;
#everything above this will be cut off
$page =~ s/^.*<\/font>//is;
#everything below this will be cut off
$page =~ s/<\/body>.*$//is;
print "Content-type: text/html\n\n";
#print result
print "$page";