for my $word (@words){ my %count; # WRONG $count{$word}++; }