in reply to Array of arrays?
#!/usr/bin/perl -w use strict; use Data::Dumper; my %descriptions; while (<DATA>) { my ($animal,$hyper,$description) = (split)[0,2,3]; if ($hyper eq 'hyper') { push @{$descriptions{$animal}}, $description; } } print Dumper \%descriptions; =prints $VAR1 = { 'alligator-n' => [ 'animal-n', 'beast-n', 'carnivore-n' ] }; =cut __DATA__ alligator-n amphibian_reptile event sleep-v alligator-n amphibian_reptile event swim-v alligator-n amphibian_reptile event walk-v alligator-n amphibian_reptile hyper animal-n alligator-n amphibian_reptile hyper beast-n alligator-n amphibian_reptile hyper carnivore-n alligator-n amphibian_reptile mero foot-n alligator-n amphibian_reptile mero jaw-n
|
|---|