Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Ending a loop of content of LWP's get-function

by turbolofi (Acolyte)
on Mar 27, 2009 at 18:07 UTC ( #753740=note: print w/replies, xml ) Need Help??


in reply to Ending a loop of content of LWP's get-function

We got it work - thanks everyone, for the pointers to the documentation (RTFM, I know), and for the reminder of how regexp behaves! Here's the code, just for future reference.
#!/usr/bin/perl -w # Get urls from result page use warnings; use strict; use LWP::Simple; my ($html, $url, @urls); my $count = 0; $html = get("http://localhost:8080/html.htm") or die "Couldn't fetch p +age."; while($html =~ m{<(a class=\"smallV110\" href=\"/)(.*?)\">}g) { my $new_url = $2; print "$new_url\n"; $count++; print "$count\n"; push @urls, $new_url; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://753740]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2018-01-20 00:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (226 votes). Check out past polls.

    Notices?