http://www.perlmonks.org?node_id=232679


in reply to Re: what's this loo code? (*slurp*)
in thread what's this loo code?

Efficient:
perl -ne'BEGIN{$/=\65536} $a+=tr/\n//; END{print"$a\n"}' file
Pity there's no way to set $/ to a reference to a number using a switch.

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Re^2: what's this loo code? (*slurp*)
by John M. Dlugosz (Monsignor) on Feb 05, 2003 at 03:58 UTC
    If the last line doesn't end with a \n (that is, \n is not the last character in the last chunk) you'll be off by one.