my $mech = WWW::Mechanize->new( cookie_jar => { file => 'cookies.txt', ignore_discard => 1, autosave => 1 } ); $mech->get($add); my @links = $mech->find_all_images(url_regex => qr/jpg/); my $countphotos; for my $img (@links) { $countphotos++; my $photofile ="photo" . $countphotos . '.jpg'; my $a = $img -> url_abs; $mech->mirror( $a, $photofile ); }