Imagine that each row of @N represents information
about some important object.
Every innermost letter
represents a scalar. All other letters are names of
arrays.
Relationships so far:
@L is $N[0] @C is $L[0] @C is $N[0][0] $A is $C[0] $A is $N[0][0][0] $B is $C[1] $B is $N[0][0][1] @J is $L[1] @J is $N[0][1] @F is $J[0] @F is $N[0][1][0] $D is $F[0] $D is $N[0][1][0][1] $E is $F[1] $E is $N[0][1][0][2] @I is $J[1] @I (is $N[0][1][1] $G is $I[0] $G is $N[0][1][1][0] $H is $I[1] $H is $N[0][1][1][1] $K is $L[2] $K is $N[0][2] @M is $N[1]
Arrays can be stored as references (scalars) and retrieved
(converted
back from references to normal arrays).
To store an array as a reference, precede its name by \ :
# add scalars to @C push @C, $A; push @C, $B; # add scalars to @F push @F, $D; push @F, $E; # add scalars to @I push @I, $G; push @I, $H; # add arrays F and I as references to @J push @J, \@F; push @J, \@I; # add array C and J as references to @L; add K push @L, \@C; push @L, \@J; push @L, $K; # add array L as a reference to @N push @N, \@L; # with proper buildup, array M could be added to @N push @M, \@L;
Dereference notation:
$ref # reference @{$ref} # array made from reference
@{$ref} # array made from reference ${$ref}[5] # element 5 of the array
${$N[0]}[0] reduces to $N[0][0] ${${$N[0]}[0]}[0] reduces to $N[0][0][0]
Item $i in @N is $N[$i] Item 0 in @N is $N[0] The array in $N[0] is @{$N[0]} Therefore @L is @{$N[0]} Item $j in @L is $L[$j] or ${$N[0]}[$j] or $N[0][$j] Item 0 in @L is $L[0] or ${$N[0]}[0] or $N[0][0] The array in $L[0] is @{$L[0]} or @{${$N[0]}[0]} or @{$N[0][0]} Therefore @C is @{$L[0]} or @{${$N[0]}[0]} or @{$N[0][0]} Item 0 in @C is $C[0] or ${${$N[0]}[0]}[0] or $N[0][0][0] Therefore $A is $C[0] or ${${$N[0]}[0]}[0] or $N[0][0][0] Item 1 in @C is $C[1] or ${${$N[0]}[0]}[1] or $N[0][0][1] Therefore $B is $C[1] or ${${$N[0]}[0]}[1] or $N[0][0][1] Item 1 in @L is $L[1] or ${$N[0]}[1] or $N[0][1] The array in $L[1] is @{$L[1]} or @{${$N[0]}[1]} or @{$N[0][1]} Therefore @J is @{$L[1]} or @{${$N[0]}[1]} or @{$N[0][1]} Item 0 in @J is $J[0] or ${${$N[0]}[1]}[0] or $N[0][1][0] The array in $J[0] is @{$J[0]} or ${${$N[0]}[1]}[0] or $N[0][1][0] Therefore @F is @{$J[0]} or @{${${$N[0]}[1]}[0]} or @{$N[0][1][0]} Item 0 in @F is $F[0] or ${${${$N[0]}[1]}[0]}[0] or $N[0][1][0][0] The array in $F[0] is @{$F[0]} or @{${${${$N[0]}[1]}[0]}[0]} or @{$N[0][1][0][0]} Therefore @D is @{$F[0]} or @{${${${$N[0]}[1]}[0]}[0]} or @{$N[0][1][0][0]} Item 1 in @F is $F[1] or ${${${$N[0]}[1]}[0]}[1] or $N[0][1][0][1] The array in $F[1] is @{$F[1]} or @{${${${$N[0]}[1]}[0]}[1]} or @{$N[0][1][0][1]} Therefore @E is @{$F[1]} or @{${${${$N[0]}[1]}[0]}[1]} or @{$N[0][1][0][1]} Item 1 in @J is $J[1] or ${${$N[0]}[1]}[1] or $N[0][1][1] The array in $J[1] is @{$J[1]} or ${${$N[0]}[1]}[1] or $N[0][1][1] Therefore @I is @{$J[1]} or @{${${$N[0]}[1]}[1]} or @{$N[0][1][1]} Item 0 in @I is $I[0] or ${${${$N[0]}[1]}[1]}[0] or $N[0][1][1][0] The array in $I[0] is @{$I[0]} or @{${${${$N[0]}[1]}[1]}[0]} or @{$N[0][1][1][0]} Therefore @G is @{$I[0]} or @{${${${$N[0]}[1]}[1]}[0]} or @{$N[0][1][1][0]} Item 1 in @I is $I[1] or ${${${$N[0]}[1]}[1]}[1] or $N[0][1][1][1] The array in $I[1] is @{$I[1]} or @{${${${$N[0]}[1]}[1]}[1]} or @{$N[0][1][1][1]} Therefore @H is @{$I[1]} or @{${${${$N[0]}[1]}[1]}[1]} or @{$N[0][1][1][1]} Item 2 in @L is $L[2] or ${$N[0]}[2] or $N[0][2] Therefore $K is $L[2] or ${$N[0]}[2] or $N[0][2] Item 1 in @N is $N[1] The array in $N[1] is @{$N[1]} Therefore @M is @{$N[1]}