#!/usr/bin/perl use strict; use warnings; use open IN => ':utf8'; use open OUT => ':utf8'; use Encode; use Data::Dumper; my $file1 = shift; my %hash; open( my $IN1, "<:encoding(utf8)", $file1 ) or die; while (<$IN1>) { chomp; my ($video, $p) = split /\t/; push( @{$hash{$video}}, $p ); #print "array of hash of $video <==== $p\n"; } close $IN1; foreach my $key ( keys %hash ) { print "$key: @{ $hash{$key} }\n" } print Dumper \%hash; #### mv89psg6zh4: A bird in a sink keeps getting under the running water from a fauc et. A bird is bathing in a sink. A bird is splashing around under a running fau cet. A bird is bathing in a sink. A bird is standing in a sink drinking water t hat 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. A bird is playing in tap water. A bird is bathing in the sink. A bird is taking a bath. $VAR1 = { '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.', 'A bird is playing in tap water.', 'A bird is bathing in the sink.', 'A bird is taking a bath.' ] };