cosmicsoup has asked for the wisdom of the Perl Monks concerning the following question:
There is a many to many relationship between $id and $person. I want to produce a list that has a count of id's for each person. It seems a hash would be the most likely way to do this. But I haven't been able to get it to work. Here is what I would like to produce for the output:open(IN, "<$file") || die "Can't open $file!\n"; while(<IN>) { chomp($_); my ($id, $stdate, $enddate, $person) = split(/\|\|/, $_); }
Any thoughts?James P 24 id's Alex S 50 id's Diane G 4 id's James A 12 id's Sam D 11 id's
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Simple perl counter
by Abigail-II (Bishop) on Apr 21, 2004 at 13:52 UTC | |
|
Re: Simple perl counter
by matija (Priest) on Apr 21, 2004 at 13:18 UTC | |
|
Re: Simple perl counter
by Limbic~Region (Chancellor) on Apr 21, 2004 at 13:15 UTC |