in reply to Re: adding a column of integers
in thread adding a column of integers

update - whoops

I just saw his tail -1 at the end, he is looking for a final total not a running one, DOH!. So option 2 below works just fine

Original dumb post

This does not work for me, is this my old perl (5.005_03) or am I doing something wrong ? If I add a continue it will work. Here is some output, I have added the > before the numbers I entered just for clarity.
:perl -lne "$sum+=$_}{print $sum" syntax error at -e line 1, near "+=" Execution of -e aborted due to compilation errors. :perl -lne '$sum+=$_}{print $sum' >1 >2 >3 :perl -lne '$sum+=$_}continue{print $sum' >1 1 >2 3 >3 6 >4 10
Cheers,
R.