Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Populate Hash

by markkawika (Monk)
on Jul 27, 2009 at 16:37 UTC ( [id://783593]=note: print w/replies, xml ) Need Help??


in reply to Populate Hash

It's because you use the hash %myHash as a global the very first time it's mentioned. You need to declare it as a local variable with:
my %myHash = ();
Also, you declare it as a hash but then use it as a scalar: $myHash->{$n}=$v; uses the $myHash scalar variable, not the %myHash hash variable.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-09-09 04:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.