Since foreach can optionally take a variable on the outside, perl interprets keys as the name of that variable, with the parans around %hash indicating the array you want to iterate over. In other words, it was expecting this:
foreach $keys (%hash) { . . . }
But since it didn't see the sigal, it threw an error about that.
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
: () { :|:& };:
Note: All code is untested, unless otherwise stated
In reply to Re: Missing $ on loop variable?
by hardburn
in thread Missing $ on loop variable?
by Cody Pendant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |