Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Weird hash behavior

by kilinrax (Deacon)
on Oct 11, 2000 at 17:14 UTC ( [id://36216]=note: print w/replies, xml ) Need Help??


in reply to Weird hash behavior

Try changing the equals sign to a comma in this line:

while (($k,$v) = each (%messages))

Then it should work.

The each function returns a 2-element list in a list context, but just the key otherwise.
What you were doing there was assinging $v to $k (when $v was undefined), and then assinging the key to $k.
As a result, $v was never assigned a value.

Replies are listed 'Best First'.
RE: Re: Weird hash behavior
by RichardH (Sexton) on Oct 11, 2000 at 19:46 UTC
    D'oh! Stupid mistake. Thanks for catching it.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-03-29 14:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found