my $img = $mech->find_image( alt_regex => qr/captcha/i, url_regex => qr/Captcha/i, ); if( $img ){ $mech->get( $img->url, ':content_file' => 'captchar.jpg'); }