in reply to Re^2: Array wierdness
in thread Array wierdness

short answer

print this on a t-shirt:

and wear it at work. ;-)

long answer

$PP[1][2]=3 is a shorter notation for $PP[1]->[2] = 3

so with

$PP[1] == $OO[1] == 1

what you are effectively doing is

1->[2] = 3

which is just populating @1

debugger-demo perl -de0

DB<46> 1->[2] = 3 DB<47> x @1 0 undef 1 undef 2 3 DB<48>

For good reasons that's forbidden under strict

DB<45> use strict; my @PP; $PP[1]=1; $PP[1][2] = 3 Can't use string ("1") as an ARRAY ref while "strict refs" in use at ( +eval 66) ...

> FWIW, assigning the numbers to the arrays in separate lines makes no difference.

Well I hope it's now clearer why...

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery