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


in reply to How can I write this in a "simpler" way?

How about:
perl -nE "$s+=$_}{say qq|total $s|" myfile.txt
(Use single-quotes for Linux).

        What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?
              -Larry Wall, 1992