# get the first level of links my @links = $mech->find_all_images(url_regex => qr/jpg$/); # follow each link to the next link foreach (@links) { $mech->follow_link ( $_->url() )};