in reply to Simple perl counter

Louis,
You will have to forgive me if this is wrong - my brain has been missing for the last couple of weeks (Philippines) and I just found it (back to work).
#!/usr/bin/perl use strict; use warnings; my $file = $ARGV[0] || 'input.txt'; open (INPUT, '<', $file) or die "Unable to open $file for reading : $! +"; my %data; while ( <INPUT> ) { chomp; my @info = split /\|\|/; push @{$data{$info[3]}}, $info[1] if ! $data{$info[3]} || ! grep / +^$info[1]$/ , @{$data{$info[3]}}; } for my $id ( keys %data ) { print "$id : " , scalar @{$data{$id}}, "\n"; }
It assumes you only want unique ids counted - it is much easier if that is not the case : $data{$name}++

Cheers - L~R