sub getFile{ my @files = @_; my $mech = WWW::Mechanize->new; my $fileIndex = 1; foreach my $file (@files){ $mech->get( $file, ':content_file' => "myFile$fileIndex.txt" ); $fileIndex++; } }