my $shown++; #### use warnings; use strict; # Enter the local directory to save downloaded files into my $savelocation = "c:\\docume~1\\name\\desktop\\downloads\\"; # If directory does not exist, create it opendir(FINDDIR, $savelocation) || mkdir($savelocation); closedir FINDDIR; # Use the subroutine below for each file you need to download &getFile("http://www.domainname.com/file.png"); &getFile("http://www.domainname.com/file.txt"); sub getFile { my $netlocation = $_[0]; my @directories = split(/\//, $netlocation); my $fname = pop(@directories); &Download($netlocation, "$savelocation$fname"); } sub Download { # the entire lwp-download program }