in reply to Re: How do i save an image with www::mechanize
in thread How do i save an image with www::mechanize

perform a regex on $r to extract the url of the image

That's fragile and error-prone. Much better to use WWW::Mechanize's built-in methods, since they actually parse the returned HTML:

$mech->get($add); my $img_obj = $mech->find_image( url_regex => qr{captcha\.php} ); $mech->get( $img_obj->url, ':content_file' => 'captchar.jpg' );

... or somesuch

Update: sorry, somehow (!) didn't see Anonymonk's post


Life is denied by lack of attention,
whether it be to cleaning windows
or trying to write a masterpiece...
-- Nadia Boulanger