nefigah has asked for the wisdom of the Perl Monks concerning the following question:
I had a question on a question I read here in Seekers of Perl Wisdom, and decided I'd better post it separately so as to not derail his thread with my noobism.
He asked:
Now, my question doesn't have to do with his exact question, as that was answered quite smartly in Hash of Arrays (populating and iterating).
Rather,
He asked:
Is it cool to populate a hash of arrays with qq or qw? e.g.my %animals = ( pets => [ qw(cat dog) ], non => [ qq(rhino giraffe) ], );
Now, my question doesn't have to do with his exact question, as that was answered quite smartly in Hash of Arrays (populating and iterating).
Rather,
I'm curious what the qq( ) is doing in the above example. Populating an array with qw( ) I certainly understand, but from what I've been able to tell from the docs and googling, qq() is just a way to say " " without having to use those characters, in case your string has double quotes but you still want interpolation.
Does that mean his array (stored by reference in the hash with the 'non' key) only contains 1 element, e.g. "rhino giraffe"? Would it have been equivalent to do non => [ "rhino giraffe" ]? My gut says no, but my brain can't justify it :P
Thanks!
Does that mean his array (stored by reference in the hash with the 'non' key) only contains 1 element, e.g. "rhino giraffe"? Would it have been equivalent to do non => [ "rhino giraffe" ]? My gut says no, but my brain can't justify it :P
Thanks!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Question on a question - qq
by jwkrahn (Abbot) on Mar 06, 2008 at 03:27 UTC | |
by nefigah (Monk) on Mar 06, 2008 at 03:42 UTC | |
Re: Question on a question - qq
by grinder (Bishop) on Mar 06, 2008 at 14:09 UTC | |
by nefigah (Monk) on Mar 06, 2008 at 19:56 UTC | |
Re: Question on a question - qq
by Narveson (Chaplain) on Mar 06, 2008 at 03:36 UTC | |
Re: Question on a question - qq
by ikegami (Patriarch) on Mar 06, 2008 at 13:37 UTC |
Back to
Seekers of Perl Wisdom