Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: push an array into Hash of Array

by wrinkles (Pilgrim)
on Sep 17, 2008 at 07:43 UTC ( #711905=note: print w/ replies, xml ) Need Help??


in reply to Re: push an array into Hash of Array
in thread push an array into Hash of Array

Is q{first} == 'first' ? If so, I wonder why you would use the former in a line of code with so many curly braces. Just curious.


Comment on Re^2: push an array into Hash of Array
Re^3: push an array into Hash of Array
by wfsp (Abbot) on Sep 17, 2008 at 08:03 UTC
    Is q{first} == 'first'
    Yes, see perlop.

    Why use it? I find it easier to parse than ' and have adopted braces as delimiters and tend to stick to them. ymmv.

    In this case though $hash{first} works find (no need for either).

      But are you really 'storing' the arrays in that hash...or just the a reference to those arrays?

      If I undef array1 and array2..will I still have values in my hash?

      Or if I tie the Hash to a DB file. Will the file contain the contents of each of the arrays...or just the array references?

        Only scalars can be hash values (see perlref). Therefore, you cannot "store an array" into a hash. You can only store the reference.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2014-08-29 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (286 votes), past polls