in reply to Re^2: Named captures or positional variables
in thread Named captures or positional variables

> Is it possible for a pragma to create "my" variables in the use-ing package?

If lexical variables are already declared in the calling package, you can change their value, e.g. with PadWalker.

Otherwise it wouldn't compile under strict if you try to use them.

Cheers Rolf

(addicted to the Perl Programming Language and ☆☆☆☆ :)

  • Comment on Re^3: Named captures or positional variables

Replies are listed 'Best First'.
Re^4: Named captures or positional variables
by tobyink (Canon) on Dec 11, 2014 at 11:25 UTC

    Declaration can be worked around using parser hacks. That's what Object::Util does. It declares and populates lexical variables for the caller. (Though it falls back to package variables if it's unable to do the parser hacking stuff.)