in reply to Extracting a row(1D array) from a multidimensional array
If I've understood want you want, $TwoDimArray[$ChosenRow] will get you an arrayref of the chosen row. To get an array from the reference, dereference it using @{ ... }. ie
my @ChosenArray = @{ $TwoDimArray[$ChosenRow] };
To find the number of elements, assign @{ $TwoDimArray[$ChosenRow] } in scalar context:
my $elements = @{ $TwoDimArray[$ChosenRow] };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Extracting a row(1D array) from a multidimensional array
by Olaf (Acolyte) on Oct 04, 2007 at 13:50 UTC |