Amusing idea. You could make perl skip the overhead of the loopcount if the compiler doesn't see anything using the variable.
If you wanted the ability to access the loopcount of other contexts, you might have the ability to treat it as an array, where $loopcount[-1] is the loopcount of the context containing this one. Getting even further out, you could also let loopcount be a hash so you could access the loopcount of a named loop with $loopcount{OUTER} or some such.
OBTW, ++ on your moniker!
...roboticus
In reply to Re: Automatic Loop Counter not in perl
by roboticus
in thread Automatic Loop Counter not in perl
by b4swine
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |