Prl_learner has asked for the wisdom of the Perl Monks concerning the following question:
hello,
I new perl learner, so forgive me if my question seemed basic.I need a perl script to look up the unique elements in array and sum the corresponding values. let me make it clear
here is how my input file will look like:Note: the file is tab delimitedAA 12 bb 34 AA 76 cc 98 dd 76 bb 98
I need the script to give me the following output:
the input is like a table of two columns or more. I don't why it appeared as a line in my question even thought I entered it as table. so basically the first column contain (AA, bb, AA, cc, dd, bb) and the second column contain (12, 34, 76, 98, 76, 98)AA 88 bb 132 cc 98 dd 76
Can anyone help me with writing this script?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: find unique elments and sum the corresponding values
by linuxer (Curate) on Feb 11, 2009 at 23:20 UTC | |
by Prl_learner (Initiate) on Feb 11, 2009 at 23:36 UTC | |
by GrandFather (Saint) on Feb 11, 2009 at 23:47 UTC | |
by linuxer (Curate) on Feb 12, 2009 at 00:03 UTC | |
by Prl_learner (Initiate) on Feb 12, 2009 at 16:17 UTC | |
|
Re: find unique elments and sum the corresponding values
by JavaFan (Canon) on Feb 12, 2009 at 00:09 UTC | |
|
Re: find unique elments and sum the corresponding values
by GrandFather (Saint) on Feb 11, 2009 at 23:17 UTC | |
by holli (Abbot) on Feb 11, 2009 at 23:22 UTC |