This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Allow "{sub f}" to compile
[perl5.git] / toke.c
diff --git a/toke.c b/toke.c
index cec8ac2..4950958 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -7432,7 +7432,7 @@ Perl_yylex(pTHX)
                else if (*s != '{' && key == KEY_sub) {
                    if (!have_name)
                        Perl_croak(aTHX_ "Illegal declaration of anonymous subroutine");
-                   else if (*s != ';')
+                   else if (*s != ';' && *s != '}')
                        Perl_croak(aTHX_ "Illegal declaration of subroutine %"SVf, SVfARG(PL_subname));
                }