On 5/22/08, Bernardo Rechea <[EMAIL PROTECTED]> wrote:
> Chris Prather wrote:
>
>  > which can also be written:
>  >
>  > sub needs_trinket () { 0 }
>  > and
>  > sub needs_trinket () { 1 }
>  >
>  > perl optimizes things with empty prototypes that return a constant.
>
>
> That's quite a wonderful bit of arcana. At least for me: I don't use
>  prototypes, so I never paid much attention to the prototypes section in the
>  camel book.
>
>
>  Bernardo
>

Coincidentally, use constant is just a nicer syntax for this. The
relevant line in constant.pm is:

    *$full_name = sub () { $scalar };

Hooray Perl. :)

Shawn

Reply via email to