Yes, you're almost there. Instead of <<__DATA__, substitute
*main::DATA. This doesn't work in the perldl shell, but does work as a
standalone script. rcols wants a file or a filehandle, and __DATA__
opens the (package)::DATA filehandle. See your Camel book for details.
#!/usr/bin/perl -w
use PDL;
use strict;
&test_read;
sub test_read {
my ($a, $b) = rcols *main::DATA;
print $a, $b;
return (1);
}
__DATA__
1 2
3 4
5 6
7 8
Derek
Matthew Kenworthy wrote:
Hi,
I'd like to have some tabular data kept with a pdl module, instead of
having a large text file external to the module.
I've been working out if it is possible to get rcols to read a __DATA__
structure - something along the lines of:
sub test_read {
($a, $b) = rcols <<__DATA__;
print $a, $b;
return (1);
}
1;
__DATA__
1 2
3 4
5 6
7 8
..but no luck so far.
Is it possible to read __DATA__ from rcols?
Thanks,
Matt
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl