develooper Front page | perl.beginners | Postings from January 2011

Newbie queries

Thread Next
From:
dolphin
Date:
January 25, 2011 02:17
Subject:
Newbie queries
Message ID:
cf331816-6f7f-41c2-8d53-099412b5b1d0@x6g2000prf.googlegroups.com
Hi,

I'm learning perl now and would like to find out how to perform the
following if given in a text file?


AAAA,12
AAAA,437
BBBB,124
CCCC,45
BBBB,789
AAAA,67
CCC,567
DDD,5


How to sum up the 2nd column based on the 1st column with the
following result:


AAAA:
BBB:
CCC:
DDD:


Thanks in advance.



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About