in reply to Difference in Hash Declaration
Say it with me:
{ 'hashes', 'are', 'curly', 'ones' }
[ 'arrays', 'are', 'square' ]
( 'lists are round' )
using and understanding strict/warnings cuts your development time in half!
#!/usr/bin/perl -- use strict;use warnings; use Data::Dump qw/ dd /; my %ro = { ( 1 => "j", 2 => "b", ), ( 1 => "p", 2 => "b", ), }; my %sham = ( ( 1 => "j", 2 => "b", ), ( 1 => "p", 2 => "b", ), ); my %bo = { { 1 => "j", 2 => "b", }, { 1 => "p", 2 => "b", }, }; dd \%ro; dd \%sham; dd \%bo; __END__ Reference found where even-sized list expected at - line 4. Reference found where even-sized list expected at - line 28. { "HASH(0x3f8c64)" => undef } { 1 => "p", 2 => "b" } { "HASH(0x99a3bc)" => undef }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Difference in Hash Declaration
by perl@1983 (Sexton) on May 07, 2012 at 08:07 UTC |