Your two examples produce the same output for me (v5.8.4 i386-linux-thread-multi). You might want to search
perldeltas for word of this fix/change (I didn't find anything clearly pointing to it in
RFC: perlfeaturedelta, but it looks like local+tie interaction has been scrutinized throughout the 5.8 sequence). It's a bummer for you, since this change and the new open usage in
BrowserUk's suggestion both were added after your perl version. I wonder if it's possible to subclass IO::Scalar and somehow get the object to untie itself upon DESTROY...
The output record separator thing seemed weird to me at first too. But I got to thinking that for tied filehandles, READLINE has to manually deal with $/. Perhaps its for consistency that PRINT should deal with $\ manually as well. Also for some applications of tied filehandles (when they are not really performing a normal "filehandlish" function), having $\ automatically appended might not make any sense. In this case, I'd email the IO::Scalar maintainer and ask for the output separator to be honored by PRINT.
Update: Also a reason for not automatically handling $\ is that you can pass multiple args to print, which are sent over raw to the tied PRINT method. Perl wants you to be able to use these multiple args to do anything you like, not just join them on $, (like a normal print). How exactly to automatically tack on $\ when there are multiple args to print is a problem!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.