my %words = ( NOUN => [], VERB => [], ADJ => []); # use stephen's part_of_speech sub push @{ $words{$part_of_speech} }, $word;