http://qs321.pair.com?node_id=1196406


in reply to Re: perl group by and sort from a csv input file
in thread perl group by and sort from a csv input file

Thanks a lot for your great help and response.

Apologies, As I am new to the perl monks, I dodnt know the rules as I didnt paste my code which I tried. from next time I will follow the same.

I have used the below code

use strict; use warnings; use feature 'say'; my %hash; while (<DATA>) { chomp; my ($id, $num, $val) = split /,/, $_; $hash{"$id,$num"} += $val; } for my $key (sort keys %hash) { say "$key,$hash{$key}"; }

Thanks a ton for all of you for this great help.