You are confusing direct assignment and computed assignment. "$b= 
$b*10" creates a new PDL and puts it in the scalar named $b, dropping  
the old one (and its dataflow connection to $a) on the floor. use  
computed assignment (".=") instead.

(Mobile)


On Jun 26, 2010, at 8:12 AM, P Kishor <[email protected]> wrote:

> perldl> $a = sequence 5, 4, 2
> perldl> p $a
> [
> [
>  [ 0  1  2  3  4]
>  [ 5  6  7  8  9]
>  [10 11 12 13 14]
>  [15 16 17 18 19]
> ]
> [
>  [20 21 22 23 24]
>  [25 26 27 28 29]
>  [30 31 32 33 34]
>  [35 36 37 38 39]
> ]
> ]
>
> **************
> perldl> $b = $a->slice(':,1:2,:')
> perldl> $b = $b * 10
> perldl> p $a
> [
> [
>  [ 0  1  2  3  4]
>  [ 5  6  7  8  9]
>  [10 11 12 13 14]
>  [15 16 17 18 19]
> ]
> [
>  [20 21 22 23 24]
>  [25 26 27 28 29]
>  [30 31 32 33 34]
>  [35 36 37 38 39]
> ]
> ]
> perldl> p $b
> [
> [
>  [ 50  60  70  80  90]
>  [100 110 120 130 140]
> ]
> [
>  [250 260 270 280 290]
>  [300 310 320 330 340]
> ]
> ]
>
> So, what happened here? Why does multiplying the slice by 10 not
> change $a as well?
>
> Turning on dataflow at *************** above with $a->doflow doesn't
> help as well (although, by my understanding, it shouldn't be needed
>
> -- 
> Puneet Kishor
>
> _______________________________________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>

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

Reply via email to