Hello All,

I have some simple files to parse. The data looks like this:

54            6342059
80            6342059
31            6158566
54            6158566
80            6158566
31            6341718
54            6341718
80            6341718
31            6341743
54            6341743
54            6341743
80            6341743
31            6341714
54            6341714
54            6341714
80            6341714
31            6188293
54            6188293
54            6188293
80            6188293
54            6713711
80            6713711
54            6713712
80            6713712
54            6489814
80            6489814
54            6713889
80            6713889
54            6713793
54            6713793
80            6713793

The first column is an activity code and the second column is a client id
number.

Here is my task. I need to find the number of unique individuals that
participated in each activity. Now the boring, tedious way would be to write
something like this:

for my $row {
  $act_54{$row1} if (column1 == "54");
  $act_80{$row1} if (column1 == "80");
  $act_90{$row1} if (column1 == "90");
}
print scalar (keys %act_54);
print scalar (keys %act_80);
print scalar (keys %act_90);

Surely, there is something that will capture the data a little easier than
defining a variable for each activity. There are more than 30 activities.

Thank you for your help.

Elton


=========================================================================
NOVA                                          505 W. Olive Ave. Suite 550
Elton Hughes (Information Technology)                  Sunnyvale CA 94086
Phone: 408-730-7235                                     Fax: 408-730-7643
-------------------------------------------------------------------------



Reply via email to