%base_lang = (
'English' => '0',
'French' => '1',
'Japanese' => '2',
);
# then we set up some magic arrays
@red = qw(red french_word_for_red japanese_word_for_red);
@hello = qw(hi bonjour japanese_word_for_hello);
# now the fun
$lang_num = $base_lang{$choice};
print "$red[$lang_num] is $choice for red\n";
print "$hello[$lang_num] is $choice for hello\n";
# so on and so forth
####
# This is a little redundant as it recreates the @red array,
# but @words has all the values so it only dissappears for
# a little bit :)
(@words) = @red;
# Now create out arrays for all the languages in the same
# order to retain our own and our data's sanity :)
foreach $item (@words) {
@{$item} = @words;
}
####
@red = qw(red french_red japanese_red);
@french_red = qw(red french_red japanese_red);
@japanese_red = qw(red french_red japanese_red);
####
# take for granted all words are within a particular array
# and we recently added German with index of 3
while ( defined($word = shift(@vocab)) ) {
print "No German word for $word!\n" if (!${$word}[3]);
}