in reply to Re: Re: constants within regular expression?
in thread constants within regular expression?

i don't know what the empty prototype implies for inlining, but it also keeps the sub from swallowing arguments.

sub A () {1}; sub B {2}; print A + 1,$/; print B + 1,$/; __END__ prompt$ perl test.pl 2 2prompt$

without the empty prototype subs wouldn't work very well for constants.

Replies are listed 'Best First'.
Re: Re: Re: Re: constants within regular expression?
by Anonymous Monk on Nov 26, 2003 at 07:54 UTC
    i don't know what the empty prototype implies for inlining

    Read this and you will (from perldoc perlsub):

    Constant Functions Functions with a prototype of "()" are potential candidates for inlin- ing. If the result after optimization and constant folding is either +a constant or a lexically-scoped scalar which has no other references, then it will be used in place of function calls made without "&". Calls made using "&" are never inlined. (See constant.pm for an easy way to declare most constants.)