in reply to Re: Interesting Use for "state" Variables
in thread Interesting Use for "state" Variables

Yes, you're right. That "fly in the ointment" just now occurred to me, and I was going to update my post to point this out. It unfortunately makes many applications (such as tracking line numbers from a file) useless, except for the very first time.  Rats.

It brings me back to a previous thought -- I wonder what it would take to implement a special Perl variable to track the loop count? For example, $* is now deprecated; perhaps it could be "reused" for something like this?

Anyway, thank you for finding my flaw early on.


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
  • Comment on Re^2: Interesting Use for "state" Variables