Hmmm. The strange thing is I actually had a 'rewind' in there at some point but removed it again because it didn't have any impact. However if I change the first copy operation to
in reply to Re: 'Anonymous' copy via file handle fails
in thread 'Anonymous' copy via file handle fails
then it magically works now. Thanks for the tip! Maybe there is some other bug lurking in the original program, but now that the basic copy works I'm sure to figure it out.
copy $src_file, $tmp1_fh
or die "$ERRNO\n";