Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

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?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2018-07-20 02:53 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (422 votes). Check out past polls.