in reply to Counting incidents of names in a file

while( <> ){ $name{(split/\|/)[0]} += 1; } foreach( keys %name ){ print "$_ = $name{$_}\n"; }