use strict; use warnings; use open IN => ':utf8'; use open OUT => ':utf8'; use Encode; my $str = <) { chomp; my ($video, $p) = split /\t/; push (@{$hash{$video}}, $p); } print "$_:\n ", join ("\n ", @{$hash{$_}}), "\n" for keys %hash; #### mv89psg6zh4: A bird in a sink keeps getting under the running water from a faucet. 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.