http://www.site.com/images/?id=345435 #### WWW::Mechanize; # to browse through the site LWP::UserAgent; # for downloading the images #### # load modules WWW::Mechanize; LWP::UserAgent; # create new sessions $mechanize = WWW::Mechanize->new(autocheck => 1); # "autocheck => 1" will show possible errors $useragent = LWP::UserAgent->new; # define useragent $agent = "Mozilla/5.0"; $mechanize->agent($useragent); $useragent->agent($agent); # define the url $mechanize->get("http://www.site.com/images/"); # fetch the content $content = $mechanize->content(); # get the image url by parsing the content with regular expressions $content =~ /php-image<\/td><\/tr>/; # the url will be extracted to $1 # download the image $time = time(); $useragent->mirror($1, "/home/cafaro/images/$time.jpg"); # provide output print "The image ($time.jpg) has been saved.\n";