foreach my $string ( @word ) { if ( $uword{ $string }[ 0 ] == 1 ) { push @{ $uword{ $string } }, $line; next; } $uword{ $string }[ 0 ] = 1; push @{ $uword{ $string } }, $line; } #this [0] is apparently not needed #maybe I'm missing something, but what do you think #that this does? #simplify to just... foreach my $string (@word) { push ( @{$uword{$string}}, $line ); } #### @{ $uword{ $seen{ $key }[ 1 ] } # there is no closing curly for the @ # its rather strange looking but # { $seen{ $key }[ 1 ] } is the key for the hash #### push @{$hash{$key}}, $value;