I'm trying Perl's PDL in the following code:
#!/usr/bin/perl -w
use strict;
use PDL::Core qw(pdl);
use PDL::Math qw(isfinite);
use PDL::Primitive qw(statsover);
my $div = 4;
my @array1 = (0..10);
my $pdl_array = log(pdl(@array1)/$div);
$pdl_array->where(!isfinite($pdl_array)) .= 0;
my($mean,$stdev) = statsover($pdl_array);
die $pdl_array,"\n",$mean," ",$stdev,"\n";
and I'm getting this error:
Undefined subroutine &PDL::divide called at ./compare_const.pl line 10.
Any hint, please?Thanks a lot.
Just add
use PDL;
and your code will work:Outputs: