# Using inline DATA instead of file for testing. #open FILE1, "text_file_with_words.txt" or die; my %hash; while (my $line=) { chomp $line; print $line,"\n"; (my $word1,my $word2) = split /:/, $line; $hash{$word1} = $word2; } # Print hash for testinf purposes while ( my ($k,$v) = each %hash ) { print "Key $k => $v\n"; } __DATA__ word1:word2 word3:word4 word5:word6