http://qs1969.pair.com?node_id=1132072


in reply to Redirecting/Restoring of Memory Files

Well, perldoc does say:
You may also, in the Bourne shell tradition, specify an EXPR beginning with ">&", in which case the rest of the string is interpreted as the name of a filehandle (or file descriptor, if numeric) to be duped (as dup(2))
And the UNIX system call dup works only with descriptors (files, pipes, FIFOs, sockets etc). So you probably shouldn't expect it to work with Perl data without an underlying descriptor.
The black hole goes away if I reopen using substr($s,length($s)) where $s is the original variable used to create the memory file handle.
Or if you reopen in append mode, as in
} else { open($fh1, '>>', \$s1) or die "Can't restore fh1"; }