in reply to which line(s) establishes a 2d arrray

$ret{$j}[$i]
is short for
$ret{$j}->[$i]

In lvalue context (e.g. on the left of a "="), -> and other dereference operators will autovivify the reference. That means dereference operators will automatically create a variable of the required variable type (e.g. ->[...] will create a hash) and place a reference to it in the variable being dereferenced. This only happens if the variable being dereferenced is undef. In other words,

$ret{$j}[$i]
is short for
( $ret{$j} //= [] )->[$i]

when used as an lvalue.

Replies are listed 'Best First'.
Re^2: which line(s) establishes a 2d arrray
by DanielM0412 (Acolyte) on Jul 28, 2011 at 19:58 UTC
    soo if i change it to
    $ret[$j][$i] = $tmp[i]; #just changed to square brackets

    it will become an array of arrays?

      yes