What did you expect to see? Have you noticed that for your sample data all the keys are the same? Is that what you intended?
A useful trick that will help us solve your problem for you is to combine your data and sample code as follows:
use strict; use warnings; use open IN => ':utf8'; use open OUT => ':utf8'; use Encode; my $str = <<STR; mv89psg6zh4 A bird in a sink keeps getting under the running water +from a faucet. mv89psg6zh4 A bird is bathing in a sink. mv89psg6zh4 A bird is splashing around under a running faucet. mv89psg6zh4 A bird is bathing in a sink. mv89psg6zh4 A bird is standing in a sink drinking water that is pou +ring out of the facet. mv89psg6zh4 A faucet is running while a bird stands in the sink bel +ow. mv89psg6zh4 A bird is playing in a sink with running water. mv89psg6zh5 A bird is playing in tap water. mv89psg6zh5 A bird is bathing in the sink. mv89psg6zh5 A bird is taking a bath. STR my %hash; open my $inFile, '<:encoding(utf8)', \$str; while (<$inFile>) { chomp; my ($video, $p) = split /\t/; push (@{$hash{$video}}, $p); } print "$_:\n ", join ("\n ", @{$hash{$_}}), "\n" for keys %hash;
Prints:
mv89psg6zh4: A bird in a sink keeps getting under the running water from a fauce +t. A bird is bathing in a sink. A bird is splashing around under a running faucet. A bird is bathing in a sink. A bird is standing in a sink drinking water that is pouring out of +the facet. A faucet is running while a bird stands in the sink below. A bird is playing in a sink with running water. mv89psg6zh5: A bird is playing in tap water. A bird is bathing in the sink. A bird is taking a bath.
Note that I've altered some of the keys.
In reply to Re: hash of arrays
by GrandFather
in thread hash of arrays
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |