in reply to Grouping By A Column
You're on the right track. You do grouping with a hash. Each time you get a row, create the entry if it doesn't exist, or add in the data:
my ($col1, $col2, $col3) = generate_data(); if (! defined $hash{$col1}) { $hash{$col1} = [ 0, 0 ] } $hash{$col1}[0] += $col2; $hash{$col1}[1] += $col3;
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Grouping By A Column
by JavaFan (Canon) on Jan 27, 2011 at 11:35 UTC | |
|
Re^2: Grouping By A Column
by rocky13 (Acolyte) on Jan 27, 2011 at 04:29 UTC | |
by GrandFather (Saint) on Jan 27, 2011 at 06:30 UTC |