http://www.perlmonks.org?node_id=1232671


in reply to Re^2: Getting for() to accept a tied array in one statement
in thread Getting for() to accept a tied array in one statement

I don't think its possible in perl to write a function foo() that will allow any of the following in the way you want:
for (foo(list)) { ... } while (foo(list)) { .... } while (<foo(list)>) { .... }
assuming that for and while are the perl built-ins, and that you're not using source filtering or keyword plugins etc.

Dave.