Welcome to the Monastery | |
PerlMonks |
A question about the diamond...by fokat (Deacon) |
on Oct 31, 2003 at 17:07 UTC ( [id://303611]=perlquestion: print w/replies, xml ) | Need Help?? |
fokat has asked for the wisdom of the Perl Monks concerning the following question: Fellow monks: While writing some pieces of a test suite, I stumbled upon this strange behavior, which the following snippet exemplifies:
The diamond is supposed to read from the files given in the command line (well, actually the files named in @ARGV) and if none is given, use STDIN. With the above definition, the snippet should print the message This should be printed..., although this does not happen in any of my perls... (5.6.0, 5.6.1, 5.8.0, 5.8.1). close()ing STDIN before assigning to it does not help much. I know I can rewrite my tests to read from a file, pipe(), etc. But I really would like to know why this happens, and if using __DATA__ to replace STDIN is possible. Best regards -lem, but some call me fokat
Back to
Seekers of Perl Wisdom
|
|