use WWW::Mechanize; use WWW::Mechanize::TreeBuilder; my $mech = ... my @list = $mech->look_down(_tag => "a", class => "links"); foreach (@list) { # see if I want to skip this row, or save/print some # data and follow link to next page # printing data works fine # following a link breaks the loop $mech->get($new_url); # finds the page no problem # do stuff on page, then go back $mech->back(); # complaint is of unitialized "tag", from the look_down # call I assume? }