narainhere has asked for the wisdom of the Perl Monks concerning the following question:
Though the right way to declare is likeuse strict; use warnings; my @arr=(12,13,14); my %hash=( "outer"=>( "cool"=>1, "Kewl"=>2,"odd" ) ); print keys %hash,"||",values %hash," ",$hash{"2"};
I am intrigued after looking at the o/p.How come the supposed to be keys "cool","kewl" became values and values 1,2 became keys.What exactly is the effect of using '()' in-place of '{}'my %hash=( "outer"=>{ "cool"=>1, "Kewl"=>2, } );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Nested (ARRAY|HASH)
by bart (Canon) on Oct 30, 2007 at 06:19 UTC | |
by narainhere (Monk) on Oct 30, 2007 at 06:38 UTC | |
|
Re: Nested (ARRAY|HASH)
by Zaxo (Archbishop) on Oct 30, 2007 at 09:04 UTC | |
|
Re: Nested (ARRAY|HASH)
by naikonta (Curate) on Oct 30, 2007 at 16:51 UTC | |
|
Re: Nested (ARRAY|HASH)
by jethro (Monsignor) on Oct 30, 2007 at 20:21 UTC |