How can I get the decreasing cumulative of frequency series using Perl?

Posted by neversaint on Stack Overflow See other posts from Stack Overflow or by neversaint
Published on 2010-03-23T01:04:16Z Indexed on 2010/03/23 17:33 UTC
Read the original article Hit count: 319

Filed under:
|

I have a data that looks like this:

3
2
1
5

What I want to get is the "decreasing" cumulative of this data yielding

11
8
6
5
0

What is the compact way of doing that in Perl?

© Stack Overflow or respective owner

Related posts about perl

Related posts about statistics