Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Multidimensional Arrays

by chb (Chaplain)
on Nov 25, 2004 at 10:54 UTC ( #410369=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Multidimensional Arrays
in thread Multidimensional Arrays

This works, too:

@{${$another[0]}}[$i]
I think ist is a little bit clearer (from in to out): 1. fetch array element 0, 2. dereference, 3. treat it like an array, 4. fetch via [$i].

But this all looks really ugly. It would be better to fix the strange assignment to @another than to use such a complicated expression just to fetch a value...


Comment on Re^3: Multidimensional Arrays
Select or Download Code
Re^4: Multidimensional Arrays
by wfsp (Abbot) on Nov 25, 2004 at 11:22 UTC
    You're right.

    I find Perl's data structures very useful but often get into a tangle with them. The main reason I had a go at the OP's question was to see if I could fathom it out. I was so pleased when I actually got something to work I couldn't resist the urge to show off!

    I must now confess that I dereferenced it in stages first using temps. This is what I usually do myself if only so that I can still understand it the following day.

    ++ to you for being helpful rather than trying to be clever. My bad!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2014-11-28 03:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (192 votes), past polls