my %hist; while () { chomp; my ($col0, @element) = split; $hist{$col0}{$_}++ for @element; };