This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Functions with a (_) prototype should behave as unary operators
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Wed, 18 Oct 2006 17:40:57 +0000 (17:40 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Wed, 18 Oct 2006 17:40:57 +0000 (17:40 +0000)
(which is not the case of functions with a (;$) prototype)

p4raw-id: //depot/perl@29041

toke.c

diff --git a/toke.c b/toke.c
index 0629099..4158e32 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -5403,7 +5403,7 @@ Perl_yylex(pTHX)
                        const char *proto = SvPV_const((SV*)cv, protolen);
                        if (!protolen)
                            TERM(FUNC0SUB);
-                       if (*proto == '$' && proto[1] == '\0')
+                       if ((*proto == '$' || *proto == '_') && proto[1] == '\0')
                            OPERATOR(UNIOPSUB);
                        while (*proto == ';')
                            proto++;