in reply to Re^3: foreach loop and creating files with "$_"
in thread foreach loop and creating files with "$_"

What's wrong with always quoting "$vars"?

Less clutter, too:

open $file, '>', $temp . $_;