Hi,

This has to do with the inability to overload the '=' in perl. We  
therefore had to use a different operator for assignment into slices,  
'.='.

This is a well-known issue for newcomers to PDL but mentioned in the  
manuals.

Try $a(1,1) .= 1

Christian

On 12/11/2009, at 8:37 PM, Gabor Szabo wrote:

> Hi everyone,
>
> This time using PDL 2.4.5
>
>
> perldl> $a = zeroes(3,3);
>
> perldl> p $a
>
> [
> [0 0 0]
> [0 0 0]
> [0 0 0]
> ]
>
> perldl> $a(1,1) = 1;
>
> perldl> p $a
>
> [
> [0 0 0]
> [0 0 0]
> [0 0 0]
> ]
>
> perldl> $a(1,1)++;
>
> perldl> p $a
>
> [
> [0 0 0]
> [0 1 0]
> [0 0 0]
> ]
>
>
>
> While I am surprised that the $a(1,1)++ syntax works but then I am  
> also
> surprised that $a(1,1) = 1 does not do anything nor does it complain.
>
> Gabor
>
> _______________________________________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

--
Christian Soeller PhD   Dept. of Physiology  +64 9 3737599 x82770
University of Auckland  Auckland, New Zealand  fax +64 9 3737499



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

Reply via email to