All compile-time uses of the ** typeglob now warn.
####
# $#- $#+ $#{%} etc.
my @x;
-@x = ($#{`}, $#{~}, $#{!}, $#{@}, $#{$}, $#{%}, $#{^}, $#{&}, $#{*});
+@x = ($#{`}, $#{~}, $#{!}, $#{@}, $#{$}, $#{%}, $#{^}, $#{&});
@x = ($#{(}, $#{)}, $#{[}, $#{{}, $#{]}, $#{}}, $#{'}, $#{"}, $#{,});
@x = ($#{<}, $#{.}, $#{>}, $#{/}, $#{?}, $#{=}, $#+, $#{\}, $#{|}, $#-);
@x = ($#{;}, $#{:});
####
+# $#{*}
+# It's a known TODO that warnings are deparsed as bits, not textually.
+no warnings;
+() = $#{*};
+####
# ${#} interpolated
# It's a known TODO that warnings are deparsed as bits, not textually.
no warnings;
require_tie_mod(gv, "!", newSVpvs("Errno"), "TIEHASH", 1);
else if (*name == '-' || *name == '+')
require_tie_mod(gv, name, newSVpvs("Tie::Hash::NamedCapture"), "TIEHASH", 0);
- } else if (sv_type == SVt_PV) {
- if (*name == '*') {
+ } else if (sv_type == SVt_PV && *name == '#') {
+ Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED,
+ WARN_SYNTAX),
+ "$# is no longer supported");
+ }
+ if (*name == '*') {
+ if (sv_type == SVt_PV)
Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED,
WARN_SYNTAX),
"$* is no longer supported, and will become a syntax error");
- } else if (*name == '#') {
- Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED,
- WARN_SYNTAX),
- "$# is no longer supported");
- }
+ else
+ Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX),
+ "%c* is deprecated, and will become a syntax error",
+ sv_type == SVt_PVAV ? '@'
+ : sv_type == SVt_PVCV ? '&'
+ : sv_type == SVt_PVHV ? '%'
+ : '*');
}
if (sv_type==SVt_PV || sv_type==SVt_PVGV) {
switch (*name) {
if (sv_type == SVt_PV)
Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX),
"$* is no longer supported, and will become a syntax error");
+ else {
+ Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX),
+ "%c* is deprecated, and will become a syntax error",
+ sv_type == SVt_PVAV ? '@'
+ : sv_type == SVt_PVCV ? '&'
+ : sv_type == SVt_PVHV ? '%'
+ : '*');
+ }
break;
case '#': /* $# */
if (sv_type == SVt_PV)
=item *
-XXX L<message|perldiag/"message">
+L%c* is deprecated, and will become a syntax error|perldiag/"%c* is deprecated, and will become a syntax error">
+
+Use of C<@*>, C<&*>, C<**> or C<%*> is now deprecated, and will generate a
+compile time warning, enabled by default. In future such code will fail to
+compile with a syntax error. Removing these variables, along with C<$*>,
+will permit future syntax additions.
=back
with C<use re '/m'>. (In older versions: when C<$*> was set to a true value
then all regular expressions behaved as if they were written using C</m>.)
+=item %c* is deprecated, and will become a syntax error
+
+(D deprecated, syntax) The punctuation variables C<@*>, C<&*>, C<**> and
+C<%*> will be removed soon. In future such code will fail to compile with a
+syntax error. Removing these variables along with C<$*> will permit future
+syntax additions.
+
=item $# is no longer supported
(D deprecated, syntax) The special variable C<$#>, deprecated in older
$a = $#;
$a = $*;
EXPECT
+@* is deprecated, and will become a syntax error at - line 3.
$# is no longer supported at - line 4.
$* is no longer supported, and will become a syntax error at - line 5.
########
EXPECT
$# is no longer supported at - line 2.
$* is no longer supported, and will become a syntax error at - line 3.
+@* is deprecated, and will become a syntax error at - line 5.
+########
+# gv.c
+$a = \@*;
+$a = \&*;
+$a = \**;
+$a = \%*;
+no warnings 'deprecated' ;
+$a = \@*;
+$a = \&*;
+$a = \**;
+$a = \%*;
+EXPECT
+@* is deprecated, and will become a syntax error at - line 2.
+&* is deprecated, and will become a syntax error at - line 3.
+** is deprecated, and will become a syntax error at - line 4.
+%* is deprecated, and will become a syntax error at - line 5.
########
# gv.c
use warnings 'syntax' ;