Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: multi-dimensional arrays, dereferencing

by fabalicious (Novice)
on Aug 08, 2003 at 10:23 UTC ( [id://282151]=note: print w/replies, xml ) Need Help??


in reply to multi-dimensional arrays, dereferencing

Cheers to skeeve and thinker. Still doesn't look very obvious to me, but it does the job.
  • Comment on Re: multi-dimensional arrays, dereferencing

Replies are listed 'Best First'.
Re: Re: multi-dimensional arrays, dereferencing
by thinker (Parson) on Aug 08, 2003 at 10:35 UTC

    Hi fabalicious

    For a good explaination, see

    perldoc perllol perldoc perlreftut

    hope this helps

    cheers

    thinker

      I would add

      perldoc perldsc

      And it happens that the free online chapter from merlyn's new book Learning Perl Objects, References and Modules covers this very topic. Check it out on the O'Reilly website.

      NB: that shouldn't stop you from buying the book :-)

      dave

Re: Re: multi-dimensional arrays, dereferencing
by Skeeve (Parson) on Aug 08, 2003 at 11:12 UTC
    An "array of arrays" is in fact an array of references to arrays. So each element of your @M is an array reference leading us to:
    foreach $aref (@M) {...
    To get the actual array from an array reference, one usually writes @$aref leading us to
    foreach $element (@$aref) {...
    and that's all about it.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-26 02:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found