Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: 2d arrays in Perl?

by physgreg (Scribe)
on Aug 21, 2002 at 08:39 UTC ( #191673=note: print w/replies, xml ) Need Help??


in reply to 2d arrays in Perl?

If you want CourseCodes to be an array, you can add elements to it like this:
push @{$thePupils[23]{"CourseCodes"}}, "99-A"; push @{$thePupils[23]{"CourseCodes"}}, "99-B";
and then access them like this:
print ${$thePupils[23]{"CourseCodes"}}[0]; print ${$thePupils[23]{"CourseCodes"}}[1];

Replies are listed 'Best First'.
Re: Re: 2d arrays in Perl?
by blokhead (Monsignor) on Aug 21, 2002 at 17:19 UTC
    Instead of this..
    print ${$thePupils[23]{"CourseCodes"}}[0]; print ${$thePupils[23]{"CourseCodes"}}[1];
    Why not just do...
    print $thePupils[23]{"CourseCodes"}[0]; print $thePupils[23]{"CourseCodes"}[1];

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2023-12-03 15:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (20 votes). Check out past polls.

    Notices?