http://qs1969.pair.com?node_id=767618

Angharad has asked for the wisdom of the Perl Monks concerning the following question:

I have a text file that looks like this
1ct9B 3 1 1f7uA 2 3 1gaxA 2 1 1gpmA 3 5 1ihoA 6 4 1mopA 6 3 1ileA 2 5 1iq0A 2 3 1vlhB 5 3 1jhdA 5 4 etc ...
The first column contains an 'item' the second column contains a 'group number' and the third item is a count. What I need to do is, for every group, retrieve the item that has the largest count. So, for the data above, the results for each group would be:
1ileA 2 5 1gpmA 3 5 1jhdA 5 4 1ihoA 6 4
I'm sure this is a very simple task, but I've not been able to work out how to do it so far. I've just created lots of hashes and not really got anywhere. All help/advice much appreciated.