SvREADONLY_on(av);
}
goto magicalize;
- case '#':
case '*':
- if (ckWARN2(WARN_DEPRECATED, WARN_SYNTAX) && len == 1 && sv_type == SVt_PV)
- Perl_warner(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX), "Use of $%s is deprecated", name);
+ if (len == 1 && sv_type == SVt_PV && ckWARN2(WARN_DEPRECATED, WARN_SYNTAX))
+ Perl_warner(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX),
+ "$* has been removed");
+ break;
+ case '#':
+ if (len == 1 && sv_type == SVt_PV && ckWARN2(WARN_DEPRECATED, WARN_SYNTAX))
+ Perl_warner(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX),
+ "Use of $# is deprecated");
/* FALL THROUGH */
case '[':
case '^':
case '!':
case '-':
case '#':
- case '*':
case '[':
case '^':
case '~':
# *ARRAY_BASE = *[ ;
# *OFMT = *# ;
-# *MULTILINE_MATCHING = ** ;
# *OLD_PERL_VERSION = *] ;
1;
#endif
(void)SvIOK_on(sv); /* what a wonderful hack! */
break;
- case '*':
- break;
#ifndef MACOS_TRADITIONAL
case '0':
break;
}
}
break;
- case '*':
- i = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
- PL_multiline = (i != 0);
- break;
case '/':
SvREFCNT_dec(PL_rs);
PL_rs = newSVsv(sv);
=head1 Incompatible Changes
+=head2 The C<$*> variable has been removed
+
+C<$*>, which was deprecated in favor of the C</s> and C</m> regexp
+modifiers, has been removed.
+
=head1 Core Enhancements
=head2 Tied Arrays with Negative Array Indices
If you find what you think is a bug, you might check the articles
recently posted to the comp.lang.perl.misc newsgroup and the perl
-bug database at http://bugs.perl.org/ . There may also be
-information at http://www.perl.com/ , the Perl Home Page.
+bug database at F<http://bugs.perl.org/>. There may also be
+information at F<http://www.perl.com/>, the Perl Home Page.
If you believe you have an unreported bug, please run the B<perlbug>
program included with your release. Be sure to trim your bug down
to have existed already, but for some reason it didn't, and had to be
created on an emergency basis to prevent a core dump.
+=item $* has been removed
+
+(D deprecated) The special variable C<$*>, deprecated in older perls, has
+been removed as of 5.9.0 and is no longer supported. You should use the
+C<//m> and C<//s> regexp modifiers instead.
+
=item Hash %%s missing the % in argument %d of %s()
(D deprecated) Really old Perl let you omit the % on hash names in some
(F) You attempted to use a feature of printf that is accessible from
only C. This usually means there's a better way to do it in Perl.
-=item Use of $* is deprecated
-
-(D deprecated) This variable magically turned on multi-line pattern
-matching, both for you and for any luckless subroutine that you happen
-to call. You should use the new C<//m> and C<//s> modifiers now to do
-that without the dangerous action-at-a-distance effects of C<$*>.
-
=item Use of $# is deprecated
(D deprecated) This was an ill-advised attempt to emulate a poorly
Treat string as single line. That is, change "." to match any character
whatsoever, even a newline, which normally it would not match.
-The C</s> and C</m> modifiers both override the C<$*> setting. That
-is, no matter what C<$*> contains, C</s> without C</m> will force
-"^" to match only at the beginning of the string and "$" to match
-only at the end (or just before a newline at the end) of the string.
-Together, as /ms, they let the "." match any character whatsoever,
+Used together, as /ms, they let the "." match any character whatsoever,
while still allowing "^" and "$" to match, respectively, just after
and just before newlines within the string.
newline within the string, and "$" will match before any newline. At the
cost of a little more overhead, you can do this by using the /m modifier
on the pattern match operator. (Older programs did this by setting C<$*>,
-but this practice is now deprecated.)
+but this practice has been removed in perl 5.9.)
To simplify multi-line substitutions, the "." character never matches a
newline unless you use the C</s> modifier, which in effect tells Perl to pretend
-the string is a single line--even if it isn't. The C</s> modifier also
-overrides the setting of C<$*>, in case you have some (badly behaved) older
-code that sets it in another module.
+the string is a single line--even if it isn't.
The following standard quantifiers are recognized:
how many subgroups were in the last successful match. See the
examples given for the C<@-> variable.
-=item $MULTILINE_MATCHING
-
-=item $*
-
-Set to a non-zero integer value to do multi-line matching within a
-string, 0 (or undefined) to tell Perl that it can assume that strings
-contain a single line, for the purpose of optimizing pattern matches.
-Pattern matches on strings containing multiple newlines can produce
-confusing results when C<$*> is 0 or undefined. Default is undefined.
-(Mnemonic: * matches multiple things.) This variable influences the
-interpretation of only C<^> and C<$>. A literal newline can be searched
-for even when C<$* == 0>.
-
-Use of C<$*> is deprecated in modern Perl, supplanted by
-the C</s> and C</m> modifiers on pattern matching.
-
-Assigning a non-numerical value to C<$*> triggers a warning (and makes
-C<$*> act if C<$* == 0>), while assigning a numerical value to C<$*>
-makes that an implicit C<int> is applied on the value.
-
=item HANDLE->input_line_number(EXPR)
=item $INPUT_LINE_NUMBER
s++;
}
}
- if (pm->op_pmflags & (PMf_MULTILINE|PMf_SINGLELINE)) {
+ if ((pm->op_pmflags & PMf_MULTILINE) != PL_multiline) {
SAVEINT(PL_multiline);
PL_multiline = pm->op_pmflags & PMf_MULTILINE;
}
if (SvSCREAM(TARG))
r_flags |= REXEC_SCREAM;
- if (pm->op_pmflags & (PMf_MULTILINE|PMf_SINGLELINE)) {
+ if ((pm->op_pmflags & PMf_MULTILINE) != PL_multiline) {
SAVEINT(PL_multiline);
PL_multiline = pm->op_pmflags & PMf_MULTILINE;
}
? REXEC_COPY_STR : 0;
if (SvSCREAM(TARG))
r_flags |= REXEC_SCREAM;
- if (pm->op_pmflags & (PMf_MULTILINE|PMf_SINGLELINE)) {
+ if ((pm->op_pmflags & PMf_MULTILINE) != PL_multiline) {
SAVEINT(PL_multiline);
PL_multiline = pm->op_pmflags & PMf_MULTILINE;
}
fred() ;
Use of $# is deprecated
- Use of $* is deprecated
+ $* has been removed
$a = ${"#"} ;
$a = ${"*"} ;
$a = ${"*"};
EXPECT
Use of $# is deprecated at - line 3.
-Use of $* is deprecated at - line 4.
+$* has been removed at - line 4.
$| = 1;
-print "1..998\n";
+print "1..1004\n";
BEGIN {
chdir 't' if -d 't';
if ($x =~ /^abc/) {print "ok 1\n";} else {print "not ok 1\n";}
if ($x !~ /^def/) {print "ok 2\n";} else {print "not ok 2\n";}
-$* = 1;
-if ($x =~ /^def/) {print "ok 3\n";} else {print "not ok 3\n";}
-$* = 0;
+# used to be a test for $*
+if ($x =~ /^def/m) {print "ok 3\n";} else {print "not ok 3\n";}
$_ = '123';
if (/^([0-9][0-9]*)/) {print "ok 4\n";} else {print "not ok 4\n";}
if (/^$_$/) {print "ok 23\n";} else {print "not ok 23\n";}
-$* = 1; # test 3 only tested the optimized version--this one is for real
-if ("ab\ncd\n" =~ /^cd/) {print "ok 24\n";} else {print "not ok 24\n";}
-$* = 0;
+# used to be a test for $*
+if ("ab\ncd\n" =~ /^cd/m) {print "ok 24\n";} else {print "not ok 24\n";}
$XXX{123} = 123;
$XXX{234} = 234;
ok("\x{100}X" =~ /$re/, "S_cl_and ANYOF_UNICODE & ANYOF_INVERTED");
}
-# last test 998
+# bug #22354
+sub func ($) {
+ ok( "a\nb" !~ /^b/, $_[0] );
+ ok( "a\nb" =~ /^b/m, "$_[0] - with /m" );
+}
+func "standalone";
+$_ = "x"; s/x/func "in subst"/e;
+$_ = "x"; s/x/func "in multiline subst"/em;
+#$_ = "x"; /x(?{func "in regexp"})/;
+#$_ = "x"; /x(?{func "in multiline regexp"})/m;
+
+# last test 1004
ok($x =~ /^abc/);
ok($x !~ /^def/);
-$* = 1;
-ok($x =~ /^def/);
-$* = 0;
+# used to be a test for $*
+ok($x =~ /^def/m);
$_ = '123';
study;
ok(/^$_$/);
-$* = 1; # test 3 only tested the optimized version--this one is for real
-ok("ab\ncd\n" =~ /^cd/);
+# used to be a test for $*
+ok("ab\ncd\n" =~ /^cd/m);
if ($^O eq 'os390' or $^O eq 'posix-bc' or $^O eq 'MacOS') {
# Even with the alarm() OS/390 and BS2000 can't manage these tests