Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

RE: array of arrays

by h0mee (Acolyte)
on Feb 15, 2000 at 00:32 UTC ( [id://3471]=note: print w/replies, xml ) Need Help??


in reply to array of arrays

Easy:
@list = qw(this that and another); @array = ([@list], [1, 2, 3]); #value of $array[0][2] is now 'that'
You can then reference the internal arrays as you would any multidimensional array.
The thing to keep in mind here is that hashes and arrays can only keep scalar values- so referencing
@array
is doing it in list mode.
[@array] \@array
is fetching it as a reference. Keep in mind that that \@array is only a shallow copy- modifying the value in a dereferenced context will modify @array itself, where as modifying the value of [@array] will keep @array untouched.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-13 22:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found