http://qs321.pair.com?node_id=164524

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

  • Comment on How can I Compute address of elements of Multidimensional Array

Replies are listed 'Best First'.
Re: How can I Compute address of elements of Multidimensional Array
by ariels (Curate) on May 07, 2002 at 08:24 UTC

    Perl doesn't let you compute the "address of" anything, really. Even a scalar needn't live in a contiguous block of memory. You're probably thinking of references... And that gives you your answer: just bung a quick `<samp>\</samp>' on the element you want to access:

    @x = (1,2,3); @y = (4,5,6); $x = [\@x, \@y]; $r = \$x->[1][2]; $$r = 8;