Why is parenthesis optional only after sub declaration?

后端 未结 4 1127
栀梦
栀梦 2020-12-05 23:40

(Assume use strict; use warnings; throughout this question.)

I am exploring the usage of sub.

sub bb { print @_; }         


        
4条回答
  •  既然无缘
    2020-12-06 00:08

    The reason is that Larry Wall is a linguist, not a computer scientist.

    Computer scientist: The grammar of the language should be as simple & clear as possible.

    • Avoids complexity in the compiler
    • Eliminates sources of ambiguity

    Larry Wall: People work differently from compilers. The language should serve the programmer, not the compiler. See also Larry Wall's outline of the three virtues of a programmer.

提交回复
热议问题