# subroutine for file downloading and moves to corresponding location sub file_download { my @temp_download_file_names=@{$_[0]}; my @temp_download_url=@{$_[1]}; my $dir_path=$_[2]; my $dir_name=$_[3]; print "\n\n Please Wait file is Downloading \n\n"; for(my $ii=0;$ii<=$#temp_download_file_names;$ii++){ $mech->get($home_url.$temp_download_url[$ii]); $http_response=$mech->res(); if($http_response->is_success){ $filename=$http_response->filename(); } else { $filename="untitled"; } $mech->save_content($filename); system "mv ./$filename $dir_path$dir_name/"; print " File name",$filename," is Downloaded \n\n"; $mech->back(); } } }