in reply to Re: how to store link array in for loop with WWW::Mechanize
in thread how to store link array in for loop with WWW::Mechanize
yitzchak on the CB made me realize I may have misunderstood what you were doing:
The output of Data::Dumper should allow you to find which version suits your needs the best.use strict; use warnings; use Data::Dumper; use WWW::Mechanize; my %links; for my $cnt (1..3) { my $url = "http://www.foo.com/p/$cnt"; my $mech = WWW::Mechanize->new(); $mech->get($url) or die "no such url"; my @link = $mech->find_all_links(tag => "a", class => "foo") or die + "can't find link"; $links{$cnt} = \@link; } # Do something with @link here, after the loop is done print Dumper \%link; # Show the content of %link
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: how to store link array in for loop with WWW::Mechanize
by haiihh (Initiate) on Nov 07, 2014 at 02:33 UTC |