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:

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
The output of Data::Dumper should allow you to find which version suits your needs the best.

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
    Eily..thanks for your response..both solution work perfect for me.. i just need to stored the link from $mech->find_all_links(tag=> "a", class =>"foo")
    into 1 array after its loop for three times with different $cnt url. thanks a lot..