in reply to $_, one lexical scope removed

Bonus points for creative thinking, but would they really be useful? dollar underscore underscore reminds me of MicroSoft inventing ... and .... to directly access higher directories. I guess your next step would be $___, $____, $_____ ....

I find dollar under useful for quickies, but as soon as my program starts growing beyond a dozen lines ( which is fairly early ), I give loop variables names. It helps to know what you think you're dealing with, so that when you discover in the debugger what you actually get, you have some expectation to compare it to.

If your caller wanted you to know what args it was called with, it would have told you. But if you really find a use for that information---so you can change it when your caller isn't looking?---I suggest putting the information in caller()'s return values.

--
TTTATCGGTCGTTATATAGATGTTTGCA

Replies are listed 'Best First'.
Re^2: $_, one lexical scope removed
by sleepingsquirrel (Chaplain) on Jul 15, 2004 at 20:11 UTC
    If your caller wanted you to know what args it was called with, it would have told you.
    Just to be clear, for the last example I wanted the BLANK to be bound to test2's $_[0] and not the caller of the anon sub's $_[0]. (And I realize it probably can't be done.)
    $_[0]="not me"; $f=test2("arg1"); $f->("arg2"); # should print "arg1, arg2"