That sounds pretty nasty, but I'm having a hard time implementing it, so I'm not sure I'm getting your point. I tried this:
and called it with# nasty.pl use strict; use warnings; $| = 1; print 'first line: ', scalar <>; while (<>) { print "first loop: $_"; } while (<STDIN>) { print "second loop: $_"; } __END__
I was expecting, from what you wrote, that the first loop would read STDIN, but that's not what the output shows (if I remove the second loop, the first loop still doesn't produce any output). What am I missing?% echo 'just another one-line file' > one-line_file % yes junk | head -3 | perl nasty.pl one-line_file first line: just another one-line file second loop: junk second loop: junk second loop: junk
the lowliest monk
In reply to Re^4: Which is your favourite cmt-deserving Perl feature?
by tlm
in thread Which is your favourite cmt-deserving Perl feature?
by blazar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |