Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Difference in Hash Declaration

by Anonymous Monk
on May 07, 2012 at 07:17 UTC ( [id://969197]=note: print w/replies, xml ) Need Help??


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
    Thanks. This is useful.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-20 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found