All I can say is,, I've not had a good day. This is the correct code for getting the most popular value. I'd forgot to update $count with $value
foreach my $field (keys %found) { # foreach field my $value=''; my $count=0; foreach my $key (keys %{$found{$field}}) { # foreach field -> value # if current key's tally is > the previous, store it if ($found{$field}{$key} > $count) { $count=$found{$field}{$key}; $value=$key; } } $values{$field}=$value; } -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/