use WWW::Mechanize; sub getfile { my($url, $file) = @_; my $mech = WWW::Mechanize->new(); $mech->get("$url", ':content_file' => "$file"); #delete $mech and test to see if it is deleted #$mech->die; #$mech->delete; #$mech->giberish; $mech->get("$url", ':content_file' => ".\\afterdel.jpg"); } 1;