Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

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.

Replies are listed 'Best First'.
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?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2016-10-26 05:50 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (336 votes). Check out past polls.