Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: What causes HASH to print?

by holli (Abbot)
on Feb 27, 2007 at 15:41 UTC ( [id://602313]=note: print w/replies, xml ) Need Help??


in reply to What causes HASH to print?

Because you don't have a hash, or better you have a hash with a hashref as a key and no value assigned.
Replace the curlies and make that
%SA_DATA_LOCK_DOWN = ( 'SECALERT_ALERTS_ID'=>0, 'SECALERT_NUM'=>0, 'TECH_SPEC_ID'=>0, 'OS_APP_NAME'=>0, )


holli, /regexed monk/

Replies are listed 'Best First'.
Re^2: What causes HASH to print?
by Thelonius (Priest) on Feb 27, 2007 at 16:32 UTC
    If you have "use warnings;" in your code (or run with "perl -w"), you should get the warning:
    Reference found where even-sized list expected
    If you don't have "use warnings;", then put it in before asking a question. The warnings are there to help you, not annoy you.

    UPDATE: And, if the warning is a little obscure, which in this case it is if you haven't seen it before, you can also "use diagnostics;". For example, perl -Mdiagnostics -w pm602312.pl gives:

    Reference found where even-sized list expected at pm602312.pl line 2 (W misc) You gave a single reference where Perl was expecting a list with an even number of elements (for assignment to a hash). This usua +lly means that you used the anon hash constructor when you meant to use parens. In any case, a hash requires key/value pairs. %hash = { one => 1, two => 2, }; # WRONG %hash = [ qw/ an anon array / ]; # WRONG %hash = ( one => 1, two => 2, ); # right %hash = qw( one 1 two 2 ); # also fine

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-04-20 03:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found