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


in reply to Re^2: simply appending to a scalar...
in thread simply appending to a scalar...

Because syswrite operates at the system level, bypassing Perl's higher-level file IO.

Let me just say this however: Of the seven ways I listed for appending information to a string, in-memory filehandles are the most difficult, least Perlish one; the one that I strongly urge you to consider not using. There are three ways down from the top floor of the Sears Tower building: You can take the elevator, you can take the staircase, or you can jump off the roof. I would advise against jumping off the roof. But doing so will get you to the bottom, pronto.

There is a very limited set of problems for which using in-memory filehandles will be the optimal choice. ...very limited, and you rarely see them in run-of-the-mill everyday code. It's a little like symbolic references (though even less useful); they exist, they have uses, but you will rarely see them in code, and will probably never actually need to implement them yourself.

You may have one of those fairly uncommon situations where the in-memory filehandle leads to better code. If you do, I'd love to see what that application is. Then the next time someone asks where it's a good idea to use them, I'll have at least one good example. lol


Dave