Keep It Simple, Stupid | |
PerlMonks |
Re^4: command line perl reading from STDINby Anonymous Monk |
on Jan 23, 2013 at 23:32 UTC ( [id://1015044]=note: print w/replies, xml ) | Need Help?? |
perl -ne ' $s=<>; <>; <>; do_something_with_$s'
is equivalent to perl -e ' while (<>) { $s=<>; <>; <>; do_something_with_$s} ' so 4 lines will be read each pass, but only the second line will be used for anything Personally, I'd go with something like perl -ne 'chomp; print length($_)."\n" if (/^@/);' instead.
In Section
Seekers of Perl Wisdom
|
|