Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

How can I Compute address of elements of Multidimensional Array

by Anonymous Monk
on May 07, 2002 at 04:21 UTC ( [id://164524]=perlquestion: print w/replies, xml ) Need Help??

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;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://164524]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (1)
As of 2024-04-25 04:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found