Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Two dimensional array problem

by flocto (Pilgrim)
on Jul 21, 2002 at 09:30 UTC ( [id://183801]=note: print w/replies, xml ) Need Help??


in reply to Two dimensional array problem

> How do I correctly set up and reference this array?

If I was you I'd rather use an array reference. There is no need to do this, but it feels more appropriate. Your array could look like this:

my $array_ref = [ [ 123, 456 ], [ 234, 567 ], [ 345, 678 ] ];

This array reference can be used in a variety of ways, but the most obvious are these:

my $pos = $array_ref->[$x][$y]; my $row = $array_ref->[$x]; my $column = $row->[$y];

Regards,
-octo

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-04-26 03:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found