According to the docs of
File::Temp, if you use
File::Temp::tempfile in scalar context, it only returns the filehandle. You can then use this filehandle as an argument to
File::Copy::copy, which accepts both filenames and filehandles.
Update: You'll have to find out if the warning in
File::Copy's docs about using filehandles apply to your situation.
Arjen