in reply to WHY does 'open' have a new trick?

It's certainly cool and easy :) The reason it's easy is that it fits in very well with how *nix thinks of files - as an ordered bag of bytes.

Reading a file from disk involves pulling blocks of data off the wires and putting them in a memory buffer. If we just forget about the disk and write data into the buffer directly, what we get is just like a file, as far as the user is concerned.

Getting perl to make use of that involved adding syntax to tell open that you want the new trick. Using a reference to a string was a brilliant choice, imo. It is compact, simple, and provides a natural way to set and recover the data.

None of the above is informed by the actual implementation in PerlIO, just the general properties of *nix systems.

After Compline,
Zaxo