in reply to Re^3: Return a Reference or Array?
in thread Return a Reference or Array?

From the docs (perldoc perlsub):
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.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^5: Return a Reference or Array?
by morgon (Priest) on Apr 06, 2009 at 22:48 UTC
    Well ok - I knew that.

    In our example we actually do supply an argument list to both calls, yet moritz above mentioned that there were still differences (e.g. prototype checking).

    So my question was: Are there any more (and if so which) differences between calling &foo(@args) and foo(@args) (assuming @args to non-empty).

      Are there any more (and if so which) differences between calling &foo(@args) and foo(@args) (assuming @args to non-empty).

      Only one: &foo(@args) has one useless character.