Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Problems with 'strict' and variables created on the fly

by Notromda (Pilgrim)
on Nov 11, 2002 at 03:17 UTC ( [id://211852]=note: print w/replies, xml ) Need Help??


in reply to Problems with 'strict' and variables created on the fly

Is it possible to have for a hash array element contain a list array? (a possible solution)

Well, yes!

Untested code:

my %pages; $pages{"page1"} = [ 1,2,3]; $pages{"page2"} = [ 5,6,7]; print $pages{"page1"}->[1]; print $pages{"page2"}->[2];

What you are looking for is a hash of arrays, which is a common perl idiom. Check out the perldsc and perllol manual pages.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://211852]
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 2024-04-19 11:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found