in reply to Surpised by foreach iterator limitation

There are a few places in Perl where you have to use a "simple scalar variable". The iterator binding for a foreach loop is one. The variable of an indirect filehandle read or write is another, as is the indirect object of indirect object syntax, or the expression for which you don't need braces on a dereferencing operation.

It's a consistent notion, but not always common-sense, as evidenced by your (thankfully categorically rare) post.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.