This may be easier done with a hash, and that way it also doesn't matter if the "duplicates" come right after each other. Pseudo-code:
create a hash foreach key and value pair in 2d array drop .\d from key if key exists in hash increase the key's value by the current value from array else add current key/value to hash loop through hash, printing keys and values
Aaron B.
My Woefully Neglected Blog, where I occasionally mention Perl.
In reply to Re: Combining Duplicate entries in an Array
by aaron_baugher
in thread Combining Duplicate entries in an Array
by mmartin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |