foreach my $customer (@xmlFileNames) { $customer =~ s/\.xml//g; system ("/usr/local/bin/unzip ${customer}.zip ${customer}.xml ${customer}.pdf ${customer}.xls"); }