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

Dear fellow Monks,

I have a list with three columns. The first one contains a list of IDs,second different values and third a value or blank (its A\t1_x\tblank). The ID is being repeated many times with different or same values. Example

What I would like to get is a list of IDs with corresponding number of 1_x and any non blank value in third column. So from the above example A 3,2 B 1,1 C 1,2.
The list is preaty long so I though maybe I should go line by line append to hash and get the number of 1_x and any non blank string in third column? I started with appending the values in three arrays replacing blanks with NA (thought it might help). How should I tackle this to only go through the list once and not for each ID? Thanks for help

Update: The output part of the above code breaks for a given ID if (a) '1_x' never appears in column 2, or (b) '1_x' appears in column 2 but there is never a third column for this ID. To understand what I mean, add the following lines to __DATA__: