foreach $file (@files) { $file =~ s/\s*$//; @command = `ls -l|grep $file`; print @command; system("/usr/bin/perl hash.pl $file"); }