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.
In reply to Re^2: for loop error
by almut
in thread for loop error
by satzbu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |