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;'
|
|---|