in reply to for loop error
Either use $_ as the key to your hash in the loop or explicitly specify foreach my $k keys($xhash)
I think the real problem here is the missing parens
foreach ( keys(%xhash) ) { [download]
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.