On 5/19/11 2:04 PM, Douglas Burke wrote:
On 5/19/11 1:39 PM, Clifford Sobchuk wrote:
I found a couple of problems in my rcols format and the regexp and
have corrected that so that rcols responds without error. I missed
that the INCLUDE is just the filter and had the listed the columns as
per the groupings, and I had forgotten the PERLCOL in the column
identifiers.
($val1, $val2, $val3, $name, $val4) = rcols ('filename.txt' ,\
0,1,2,3,8, {
INCLUDE=>'/^\s+\d\t\d\t\d+\t\w+\t\d\t\w+\s+\w+\s+\d+\t\-\d+\.\d+\s+\d+\t\d+\t0x[0-f]+$/',\
PERLCOLS => [ 3 ]})
It does capture all of the numeric data. I still can't get the name
though. Do I have to specify that the PERLCOL is a string somehow?
From
http://pdl.perl.org/?docs=IO/Misc&title=PDL::IO::Misc%20documentation#rcols__
and from how I originally wrote it (may have been changed later though),
the $name array has to come at the end and you don't include it in the
original column list - e.g. something like
($val1,$val2,$val4,$val4,$name) = rcols('foo.txt',0,1,2,8, {
INCLUDE => '/sooper-dooper-regex/',
PERLCOLS => [3]})
is what I'd expect to work.
HTH,
Doug
Saying that I do see the page above also has the following example
# read in the first column as a perl array and the next two as piddles
# with PERLCOLS changing the type of the first returned value to
# a perl list ref
($name,$x,$y) = rcols 'file4', 0, 1, 2, { PERLCOLS => [ 0 ] };
but I'm basing my comment above on the previous example:
# read in the first column as a perl array and the next two as piddles
# with the perl column returned after the piddle outputs
($x,$y,$name) = rcols 'file4', 1, 2 , { PERLCOLS => [ 0 ] };
printf "Number of names read in = %d\n", 1 + $#$name;
So I could be rambling here!
Doug
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl