sub show_classification{ my ( $wantedCategory ) = @_; #for each word in the matching category, print the word for my $key ( keys %words ) { my( $category, $word ) = split '-', $key; print "$word\n" if $category eq $wantedCategory; } }