| A function prototyped to accept no arguments is treated as a candidate for inlining by the Perl compiler. In this case sub foo(){2} will be inlined because it returns a constant. The snippet will thus print 2, because print foo(); is turned into print 2; by the compiler, no matter what you do to the definition of sub foo later on at runtime. |
CU
Robartes-
In reply to Re: Little Perl Mysteries: what's your answer?
by robartes
in thread Little Perl Mysteries: what's your answer?
by Ovid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |