>>>>> "MM" == Mike McClain <mike.j...@cox.net> writes:

  MM> On Thu, Apr 28, 2011 at 01:16:25PM -0400, Uri Guttman wrote:
  >> >>>>> "zs" == z sway <zzway...@gmail.com> writes:
  MM> <snip> 
  >> 
  zs> sub grow {
  zs> my $expr = $_[0];
  >> 
  >> this is better:
  >> my ( $expr ) = @_ ;

  MM> Better how?

* it doesn't require indexing so it is faster.
* it is the most standard way to get sub args.
* it easily allows for adding args by just putting another var
  in the ().
* you can assign the rest of the args to an array or hash (after the
  scalar args).

***** oh, it is also 1 char (not counting white space) shorter!

at least 4+ good reasons there! and not one downside reason i can think
of.

and those are also good reasons not to use shift on @_ except when it
really is needed.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
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