foreach my $file (@csvFile) { chomp ($item); &insertRecords($file); } sub insertRecords { my $fileToInsert = shift; }