Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^4: command line perl reading from STDIN

by Anonymous Monk
on Jan 23, 2013 at 23:32 UTC ( [id://1015044]=note: print w/replies, xml ) Need Help??


in reply to Re^3: command line perl reading from STDIN
in thread command line perl reading from STDIN

 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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1015044]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-03-28 08:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found