develooper Front page | perl.perl5.porters | Postings from February 2013

[perl #116943] deprecate @*, %*, &*, ** too

Thread Next
From:
Nicholas Clark
Date:
February 26, 2013 13:41
Subject:
[perl #116943] deprecate @*, %*, &*, ** too
Message ID:
rt-3.6.HEAD-31961-1361886094-1189.116943-75-0@perl.org
# New Ticket Created by  Nicholas Clark 
# Please include the string:  [perl #116943]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=116943 >


perlvar says:

    C<$*> was a variable that you could use to enable multiline matching.
    After a deprecation cycle, its magic was removed in Perl v5.10.0.
    Using it now triggers a warning: C<$* is no longer supported>.
    You should use the C</s> and C</m> regexp modifiers instead.

This is true. In that currently a warning is issued:

$ ./perl -e '$a = $*'
$* is no longer supported at -e line 1.

However, there's no such warning for other things in that typeglob.

$ ./perl -Ilib -e '@* = ( "a", "b" ); print "\$*[1] is $*[1]\n"'
$*[1] is b
$ ./perl -Ilib -e '%* = ( "a", "b" ); print "\$*{a} is $*{a}\n"'
$*{a} is b
$ ./perl -Ilib -e '** = sub { print "Hello world\n" }; &*'
Hello world


I think that we should deprecate the use of *all* of these.
With the intent of freeing up the parser so that things like

   @*array

can become meaningful in the near future. (Slurpy arrays and slurpy hashes
would be particularly useful for signatures)


I've tried to use csearch to find instances of use of these constructions on
CPAN, but it's very hard to avoid getting a heck of a lot of output from
unrelated things. As best I could work out (using a more restricted search
term), they aren't used. I think that the biggest user may well be JAPHs and
obfuscations relying on this:

$ ./perl -Ilib -le 'print ******'
1

Nicholas Clark


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About