My mistake. I know this doesn't matter since you found a
better solution but this bugged me and I found my mistake.
I was thinking that the "=" in "<&=" was required when using
a numeric file descriptor. But the "=" requests an fdopen()
instead of a dup(), that is, the new file handle ends up
sharing the same file descriptor with the old file handle.
So when $fh is closed (triggered when it goes out of scope
and gets destroyed), the file descriptor that DATA is using
also gets closed out from under it.
So just drop the "=" and my code works.
(but my friends call me "Tye")