Retract #7941. Forbidding subs m/s/etc is too cruel because
Jarkko Hietaniemi [Fri, 1 Dec 2000 19:44:44 +0000 (19:44 +0000)]
that also breaks using them as methods.

p4raw-id: //depot/perl@7943

pod/perldiag.pod
t/op/misc.t
toke.c

index abe0579..9baf175 100644 (file)
@@ -3121,13 +3121,6 @@ C<can> may break this.
        eval "sub name { ... }";
     }
 
-=item Subroutine name %s reserved for string operators
-
-(F) Certain string operators can be called with a very similar syntax
-to a function call, and therefore to avoid confusion their names are
-reserved and cannot be used as subroutine names.  The reserved names
-are: C<m s tr y q qq qw qx qr>.
-
 =item Substitution loop
 
 (P) The substitution was looping infinitely.  (Obviously, a substitution
index 6d05046..aea14c8 100755 (executable)
@@ -595,7 +595,3 @@ for (@locales) {
     print "$_ $s\n";
 }
 EXPECT
-########
-sub m {}
-EXPECT
-Subroutine name "m" reserved for string operators at - line 1.
diff --git a/toke.c b/toke.c
index c759650..90b5ad5 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -4888,8 +4888,6 @@ Perl_yylex(pTHX)
                if (isIDFIRST_lazy_if(s,UTF) || *s == '\'' ||
                    (*s == ':' && s[1] == ':'))
                {
-                   bool reserved = FALSE;
-
                    PL_expect = XBLOCK;
                    attrful = XATTRBLOCK;
                    /* remember buffer pos'n for later force_word */
@@ -4904,29 +4902,6 @@ Perl_yylex(pTHX)
                    }
                    s = skipspace(d);
                    have_name = TRUE;
-                   switch (tmpbuf[0]) {
-                   case 'm':
-                   case 's':
-                   case 'y':
-                       if (tmpbuf[1] == 0)
-                           reserved = TRUE;
-                       break;
-                   case 'q':
-                       if (tmpbuf[1] == 0 ||
-                           (strchr("qwxr", tmpbuf[1]) && tmpbuf[2] == 0))
-                           reserved = TRUE;
-                       break;
-                   case 't':
-                       if (tmpbuf[1] == 'r' && tmpbuf[2] == 0)
-                           reserved = TRUE;
-                       break;
-                   default:
-                       break;
-                   }
-                   if (reserved)
-                       Perl_croak(aTHX_
-                                  "Subroutine name \"%s\" reserved for string operators",
-                                  tmpbuf);
                }
                else {
                    if (key == KEY_my)