Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: for loop error

by apl (Monsignor)
on Apr 13, 2010 at 11:23 UTC ( #834467=note: print w/replies, xml ) Need Help??


in reply to for loop error

You use foreach keys($xhash)

Either use $_ as the key to your hash in the loop or explicitly specify foreach my $k keys($xhash)

Replies are listed 'Best First'.
Re^2: for loop error
by almut (Canon) on Apr 13, 2010 at 11:37 UTC

    I think the real problem here is the missing parens

    foreach ( keys(%xhash) ) {

    because of which Perl interprets keys as a variable name, and complains about the missing sigil...  —> use diagnostics;

    Also, it should be %xhash, not $xhash.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://834467]
help
Chatterbox?
erix .oO( note to self: running 100 syncing database instances on a single machine is hard on the hard disks )
[1nickt]: Oh, no, sins of the flesh were *especially* verboten at that monastery!

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2017-12-13 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (367 votes). Check out past polls.

    Notices?