On Apr 13, 4:07 pm, sono...@fannullone.us wrote:
> Hello,
>
>         I read somewhere that it's bad practice anymore to call a subroutine 
> like this:
>
> &subroutine();
>

Normally yes but  there are a few circumstances
where you need the sigil.  See: perldoc perlsub

>         I've also read where it's faster to call a sub like this:
> &subroutine;
>
> than it is to call like this:
> subroutine();

You may be thinking of recursive calls. From
perlsub :

     Subroutines may be called recursively.  If a
     subroutine is called using the "&" form, the
     argument list is optional, and if omitted, no @_
     array is set up for the subroutine: the @_ array
     at the time of the call is  visible to subroutine
     instead. This is an efficiency mechanism that
     new users may wish to avoid.



Also, for quick reference, see following section
in  perlfaq7:

      "What's the difference between calling a
       function as &foo and foo()?"

--
Charles DeRykus


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to