in reply to Re: Array of array building
in thread Array of array building

To manipulate individual elements, the sub-array has to be dereferenced

Literally the sentence is correct (somewhere the reference must be dereferenced, even if it is implicit). But one could get a false impression. To minimize any confusion, the easiest way to manipulate individual elements is still

$AoA[$i][$j]= $whatever;

Replies are listed 'Best First'.
Re^3: Array of array building
by wol (Hermit) on Oct 02, 2008 at 14:03 UTC
    To make it more explicit for anyone reading the code, you can use the dereference operator between the []s thus:
    $AoA[$i]->[$j]= $whatever;
    This means access an element of @AoA, dereference it and then access an element of the list you find there.

    It's optional as far as the interpreter is concerned, but sometimes it's worth being more explicit.

    Maybe one of those times is when you need a more visible reminder that you'll need to deep copy your data structures, to follow on from GrandFather's comment.

    --
    .sig : File not found.

Re^3: Array of array building
by swampyankee (Parson) on Oct 01, 2008 at 22:28 UTC

    Thanks for the correction.


    Information about American English usage here and here. Floating point issues? Please read this before posting. — emc