in reply to Re^3: Which is your favourite cmt-deserving Perl feature?
in thread Which is your favourite cmt-deserving Perl feature?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Which is your favourite cmt-deserving Perl feature?
by bmann (Priest) on Jul 24, 2005 at 02:56 UTC |