in reply to Counting positive numbers
I don't understand your example. In my book, 5 + 2 + 3 + 4 equals 14, why is the desired output 14?
As for an example of a short program, I may go for:
But that's probably not the shortest.perl -nE'/-/ or$x+=$_}{say$x'
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Counting positive numbers
by Corion (Patriarch) on Jul 05, 2010 at 12:18 UTC | |
by JavaFan (Canon) on Jul 05, 2010 at 12:27 UTC |
In Section
Seekers of Perl Wisdom