Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
How do you recursively pass an array by reference.
Example
@filesArray=(); &updateArray($path,\@filesArray); sub updateArray{ my $path = shift; my $myArray = shift; opendir(fp, $path); @dirList = readdir(fp); foreach $i(@dirList) { if (($i ne ".") && ($i ne "..")) { push @$fileArray, $path."/".$i; $spath = $path."/".$i; if( -d $spath ) { &GetDirArray($spath,\@filesArray); } } } closedir(fp); }
This doesn't work. It does in PHP. What is the problem. Any help would be appriciated.
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Recusive reference to an array
by arturo (Vicar) on Mar 29, 2001 at 03:28 UTC | |
|
Re: Recusive reference to an array
by Masem (Monsignor) on Mar 29, 2001 at 03:31 UTC | |
|
Re: Recusive reference to an array
by little (Curate) on Mar 29, 2001 at 03:29 UTC | |
|
Re: Recusive reference to an array
by enoch (Chaplain) on Mar 29, 2001 at 08:31 UTC |