D
Davy
Hi all,
I want to pass 2D array to sub function and return 2D array.
//--------------------------
For example,
use strict;
use warnings;
my @array=([1,2,3],[4,5,6],[7,8,9]);
my $array_ref = \@array;
$array_r = increase_array_element($array_ref);
sub increase_array_element {
//recover the 2D array
my @array_tmp = @{$array_ref};
print $array_tmp[2][2];
return \@array_tmp;
}
//-------------------------
But it seems the compile did not think @array_tmp is a 2D array?
Thanks!
Davy
I want to pass 2D array to sub function and return 2D array.
//--------------------------
For example,
use strict;
use warnings;
my @array=([1,2,3],[4,5,6],[7,8,9]);
my $array_ref = \@array;
$array_r = increase_array_element($array_ref);
sub increase_array_element {
//recover the 2D array
my @array_tmp = @{$array_ref};
print $array_tmp[2][2];
return \@array_tmp;
}
//-------------------------
But it seems the compile did not think @array_tmp is a 2D array?
Thanks!
Davy