For example:
anyhow to access what you need you have only to do:my @lang_array = ["english","spanish", "portuguese"]; my %language_hash; $language_hash{english} = { "color" => "red", "language" => "English", }; $language_hash{spanish} = { "color" => "rojo", "language" => "Espanol", }; #Code to choose language from array; my $chosen_language = $lang_array[number_of_chosen_language];
$returned_color = $language_hash{$chosen_language}{color};
to get back red for English or rojo for Spanish, or
$return_language = $language_hash{$chosen_language}{language};
to get English for English, and Espanol for Spanish. You CAN do a array of arrays, but that IMO tends to get confusing quick. The example I have just given is untested but it should work and there are less wordy ways of initializing the above hash, but that is something I would take some time to read up on, as they are pretty useful once you get the hang of them (hashes I mean).
-Enlil
In reply to Re: Do I need an array within an array
by Enlil
in thread Do I need an array within an array
by meetn2veg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |