On Wed, 23 May 2012 23:31:25 -0700 (PDT)
MARK BAKER <[email protected]> wrote:

>there is a weird bug i found I wonder if any one can help ???
>
>in the perldl terminal this works 
>
>pdl> $Y=sequence(255);
>pdl> $Y(:,0).= 5;
>pdl> p $Y
>
>and it prints a bunch of 5's now when you try to do it in a script 
>
>
>use PDL;
>
>$Y=sequence(255);
>$Y(:,0).= 5;
>print $Y;
>
>
>this doesn't work and it throws errors every where in both Windows and in 
>Ubuntu
>
>please help !!!
>
>-Mark 
>

It's because of the overloaded operator, which is handled
in the perldl shell, but not in Perl itself. You need to use
NiceSlice.  Also look in the PDL source /utils directory
for a filter script, which outputs correct Perl code, when
using these slices.

#!/usr/bin/perl
use warnings;
use strict;
use PDL;
use PDL::NiceSlice;

my $Y=sequence(255);
$Y(:,0).= 5;
print $Y;
__END__

0m,
Joe








_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to