Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: perl -n seemingly eating a line of input

by bart (Canon)
on May 01, 2017 at 13:00 UTC ( #1189258=note: print w/replies, xml ) Need Help??


in reply to Re^2: perl -n seemingly eating a line of input
in thread perl -n seemingly eating a line of input

Don't use -n, or change the way you process the lines:
echo -e '55\n44\n33\n22\n11\n' | perl -n -e 'push @a, $_; END{ print @ +a; } '

Explanation: -n makes perl loop through the input lines, and my code puts each line in turn onto the array. After all input is processed, I print out the array.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2023-02-01 22:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (15 votes). Check out past polls.

    Notices?