mianfeidewucan has asked for the wisdom of the Perl Monks concerning the following question:
However, there is nothing printed out. I am not sure where I wrote it wrong. Could somebody help me? Thanks!sub sub1{ for $x (0 .. 100){ $array[$x] = 0; } # omit the part for generating the array; return \@array; } ####################### main part my $index; for ($index=0; $index<2; $index++){ $arr_ref = &sub1($index); $arr[$index] = @$arr_ref; foreach (0 .. 100){ print "$arr[$index][$_]\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Question about how to return a array in subroutine to form a two dimensional array
by ig (Vicar) on Aug 05, 2012 at 19:20 UTC | |
|
Re: Question about how to return a array in subroutine to form a two dimensional array
by ww (Archbishop) on Aug 05, 2012 at 18:47 UTC | |
|
Re: Question about how to return a array in subroutine to form a two dimensional array
by Marshall (Canon) on Aug 05, 2012 at 18:36 UTC | |
|
Re: Question about how to return a array in subroutine to form a two dimensional array
by linuxkid (Sexton) on Aug 06, 2012 at 16:04 UTC |