XP is just a number | |
PerlMonks |
Re^4: binmode and one-liners (eof reads)by tye (Sage) |
on Jul 02, 2007 at 20:55 UTC ( [id://624550]=note: print w/replies, xml ) | Need Help?? |
After my previous reply, I found the time and facilities and ran a quick test and found two mistakes in your suggestion. First, it is eof() (with parens) not eof without parens that triggers ARGV magic. Second, as I suspected, eof() does read ahead:
So, if on a platform where binmode mattered, binmode() would not have been in effect for the first 4096 (resulting) bytes of the file. (But note that you don't need such a platform to perform this test.) Part of the problem here is that the impact of binmode is handled by the underlying I/O layers, not by Perl, so the bytes pre-read have already passed through the layer where binmode would be applied (but wasn't). If there is some way to get eof without parens to trigger an ARGV-magic implicit open, then I couldn't figure it out and so didn't test it. So please describe it in more detail. - tye
In Section
Seekers of Perl Wisdom
|
|