in reply to Ending a loop of content of LWP's get-function
You want to loop over the URLs, with the fetch inside the loop.
my @urls = ( "http://localhost:8080/html.htm", ); for my $url (@urls) { my $html = get($url) or die "Couldn't fetch page."; $html =~ ... ... }
Or if you plan on adding to @urls,
my @urls = ( "http://localhost:8080/html.htm", ); while (@urls) { my $url = shift(@urls); my $html = get($url) or die "Couldn't fetch page."; $html =~ ... ... push @urls, $new_url; # or @new_urls ... }
Using push results in a breadth-first search.
Using unshift results in a width-first search instead.
The former is almost surely most desirable here.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Ending a loop of content of LWP's get-function
by turbolofi (Acolyte) on Mar 27, 2009 at 17:32 UTC | |
by ikegami (Patriarch) on Mar 27, 2009 at 17:45 UTC |