In particular, I want to use rcols with the PERLCOLS option.
Here is what I want to do:
my @array; getColumn(\@array, $file, 4);
I can do this if I use \@array , but for backward compatibility I would prefer not to. Here's how I would do it using array-ref-ref:
sub getColumn { my ($arefref, $file, $colNum) = @_; my @read = rcols $file, { PERLCOLS => [$colNum] }; $$arefref = $read[-1]; return; }
But I donβt see how to make a routine that takes a ref array as an argument without saying something like @$aref = @{$read[-1]} , which, afaict, copies each element individually.
PS: after reading the PDL::IO::Misc documentation , it looks like the perl array should be $read[0] , but it is not.
PERLCOLS - an array of column numbers to be read into perl arrays and not a teenager. Any columns not specified in the explicit list of read columns will be returned after the explicit columns. (default is B).
I am using PDL v2.4.4_05 with Perl v5.10.0 created for x86_64-linux-thread-multi
flies source share