Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: perl -n seemingly eating a line of input

by ikegami (Patriarch)
on May 01, 2017 at 15:47 UTC ( [id://1189267]=note: print w/replies, xml ) Need Help??


in reply to perl -n seemingly eating a line of input

perl -n seemingly eating a line of input

Well yeah, that's the point of -n. Specifically, -n wraps your code with

LINE: while (<>) { ... }

Fix (with -n):

perl -ne'push @a, $_; END { print @a; }'

Fix (without -n):

perl -e'@a = <>; print @a;'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2024-04-18 11:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found