I am trying to create a 2d array in Perl
my code:
my @wordsList=();
my @words=();
for ($id=0; $id<=@language.length; $id++)
{
my $eng = $db->selectall_arrayref("select word from words
left outer join language
on words.languageId = language.languageId
where words.languageId = $id
;");
foreach $eng(@$eng)
{
my($word) = @$eng;
$ref_to_Array->[$id][$word] = @words($id,$word);
}
return $words($id, $word);
}
$wordsList= NextWords();
print $wordsList;
it returns non.. because I want to return the 2d array.
Update
I am still confused because when I execute the query, it gives me a list of words like :
select word from words where language_id = 1
(1=english, 2 - chinese, 3 - french)
I am using the for loop through the language and in order to get all the words from the database
The problem is I want to loop and want the array is added to the 2d array automatically.