in reply to How to print a newline in oneliners ...

I use the -l switch without a value all the time:

for i in {0..9}; do echo $i; done | perl -nle '$_++; print'

It's the equivalent of $\ = $/ and a chomp on the input.

Replies are listed 'Best First'.
Re^2: How to print a newline in oneliners ...
by GotToBTru (Prior) on Apr 22, 2014 at 17:43 UTC
    for in in {0..9}; do echo $i; done | perl -nle 'print ++$_'

      Well if you wanna play that game... ;-)

      for i in {0..9}; do echo $i; done | perl -ple '$_++'