Either use $_ as the key to your hash in the loop or explicitly specify foreach my $k keys($xhash)
In reply to Re: for loop error by apl in thread for loop error by satzbu