The future of deprecated special variables

178 Views Asked by At

Are deprecated special variables (like $# and $*) lost forever or would it be possible the reuse them in a future Perl version?

2

There are 2 best solutions below

3
On BEST ANSWER

There's no reason why they couldn't be reused if an appropriate use 5.16 or some such is present, but that would be terribly unlikely. Firstly because it's just asking for trouble (it will confuse the hell out of people), secondly because special variables are a nasty thing anyway and introducing a new one is rarely a good idea. You can probably consider them lost forever.

1
On

There is no problem using them in versions of Perl where they have been deprecated.

I use the $* variable in my module Whatever that creates a Perl6-ish whatever-star (*) for Perl 5.

Be sure to use glob aliasing to assign to the variable. That will circumvent any deprecated warnings and will remove any tie magic from the variable.

** = \"\x{27}";  # assigns to $*

If you wanted to do this tersly from the command line, you could put that line in a module:

In file 'q.pm' installed into your perl library path:

** = \"\x{27}";

Then you could write:

perl -Mq -e '... use $* here ...'