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; #### require ".\\mynetutils.pl"; #This downloads a nice pic of a sunset for testing the subroutine &getfile("http://artwall.us/scenic/tropical/images/sunset.jpg",".\\test.jpg"); #### C:\>test.pl Can't locate object method "delete" via package "WWW::Mechanize" at .\mynetutils .pl line 11.