I have this data contained in a file
BIN COUNT
1 20
2 0
2 1
3 0
3 0
3 1
7 0
8 2
9 1
9 2
10 3
I split this and stored in a hash
$hash{seq++} = {
BIN => $bin_num,
COUNT => $count,
};
I wanted to merge the duplicate BINs into one and sum up their values (counts). The output would look like this:
BIN COUNT
1 20
2 1
3 1
7 0
8 2
9 3
10 3
I was able to loop through hash and display it but cannot proceed with my desired output. I don't know how to do it. Please help!