in reply to Re^7: Help on foreach loop
in thread Help on foreach loop

Read in perlop about `` (aka qx). If you want just one result, use qx in list context: ($newFile) = `...` but be aware that it will have a newline appended, so chomp($newFile) afterwards. I don't have the sense that you are trying pieces of your solution individually; I think you will find this much easier than repeatedly trying small changes in your whole script. I get undef from from `grep -l nosuchmatch *`, for instance.