Blue_eyed_son has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to load a large piddle, and have found online that it will work if I set $PDL::BIGPDL=1.
But just writing $PDL::BIGPDL=1 in the file doesn't do it, writing
$name->$PDL::BIGPDL=1;
doesn't do it. Neither does
$name=$PDL::BIGPDL=1;
Has anyone loaded a pdl>1Gb with success?

Replies are listed 'Best First'.
Re: How to call $PDL::BIGPDL=1?
by JadeNB (Chaplain) on Sep 13, 2008 at 20:57 UTC
    You say 'writing $PDL::BIGPDL=1 doesn't do it'. What is the code? What error message do you get? Could it be that you typed, say, $PDL::BigPDL=1 (not all-caps) instead?

    Note that $name->$PDL::BIGPDL tries to call the method whose name is stored in $PDL::BIGPDL on the object $name, which is almost certainly not what you want; and $name = $PDL::BIGPDL = 1 will indeed set $PDL::BIGPDL to 1, but will then put that same 1 into $name, which is probably not what you want. Qualifying $BIGPDL with PDL:: already specifies the package; you don't need the help of an object to do this.

      Got it: when I try this:
      $name=$PDL::BIGPDL=zeroes($large_number1,$large_number2);
      It works. Thank you.
        For posterity; the minimum you need to do is:
        $PDL::BIGPDL=1; # true value $name=zeroes($large_number1,$large_number2); # now size not checked
        An even better solution to the problem is to use PDL::IO::FastRaw and memory-map a disk-file, which doesn't allocate any RAM at all:
        use PDL::IO::FastRaw; $name=mapfraw( 'fname', {Creat => 1, Dims => [$large_number1,$large_number2]} );