open (FILEIN2, $filetwo) or die "Can't open file.\n"; open (FILEOUT8, ">$hashtable") or die "Can't open debug file to be translated.\n"; ## Go through each line and replace while () { next unless ( /.:\s*\S/ ); my ( $lang, $text ) = split /:/, $_, 2; if ( $lang eq "Default" ) { $englishword = trim( $text ); # takes care of chomping } elsif ( $lang eq "Spanish_LatinAmerican|es_MX" ) { $spanishword = trim( $text ); $langhash{$spanishword} = $englishword; } } while (($spanishword, $englishword) = each %langhash){ ## Test print of entire hash table print FILEOUT8 "$spanishword => $englishword\n"; } close(FILEIN2); close(FILEOUT8);