But I'll add a bookmark to your solution because it does answer the question by storing the reference to the array. Thanks!
Just for laughs, here is my code. I am recursing through 6 levels this way, but I feel it will work for any number of levels:
$query[$level]->execute; while((@level_data)=$query[$level]->fetchrow_array) { %treepos = (); # reset the whereclause for a new branch %pathpos = (); $treepos{$key} = shift @level_data; $pathquery[$level] = &path_sql($childlevel,$treepos{$key}); while((@path_data)=$pathquery[$level]->fetchrow_array) { $pathpos{$key} = shift @path_data; &level_proc; } } sub level_proc { $query[$childlevel] = &level_sql($childlevel,$treepos{$key}); while((@level_data)=$query[$childlevel]->fetchrow_array) { &setlevel($childlevel); $treepos{$key} = shift @level_data; &path_proc; $treepos{$key} = undef; &setlevel($parlevel); } sub path_proc { $pathquery[$level]= &path_sql($pathpos{$parkey},$treepos{$key} +); while((@path_data)=$pathquery[$level]->fetchrow_array) { $pathpos{$key} = shift @path_data; &children_proc; } } } sub children_proc { &children_sql($pathpos{$key},$childlevel); &level_proc; }
In reply to Re^2: Two-dimensional dynamic array
by Peamasii
in thread Two-dimensional dynamic array
by Peamasii
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |