my $words = { 'foo' => [ 'nn', 'nns' ], 'bar' => [ 'nvbg', 'np' ], }; my $lookup = 'foo'; print $words->{$lookup}->[0]; # Would print 'nn', the first tag foreach my $tag (@{$words->{$lookup}}) { # This would print the tags for a specified word, in the order in which they were defined print $tag . "\n"; } # To add a new word and/or tag: push @{$words->{'baz'}}, 'nps'; # To delete a tag: @{$words->{'baz'}} = grep { $_ ne 'nps' } @{$words->{'baz'}}; # To check for a specific tag: if ( grep { $_ eq 'nps' } @{$words->{'baz'}} ) { ... }