in reply to Conditional initialisation
But the particular problem you cited is not actually something I would have run into myself, because I've never used that sort of idiom in a subroutine. So I'm curious... what's the motivation for doing this:
as opposed to doing this (which is what I always do, and I thought everybody always did it pretty much this way):my @list; @list = @_ if ( @_ > 0 ); # (using the "safe" form) # when no args have been passed, @list is empty (undef) at this point. +..
If there's a difference between those two, I'm having trouble seeing it. (Well, okay, with the former, one can easily fall into the trap that you described, but besides that, what's the difference?)my @list = @_; # when no args have been passed, @list is empty (undef) at this point. +..
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Conditional initialisation
by Akhasha (Scribe) on May 25, 2004 at 01:44 UTC | |
by dragonchild (Archbishop) on May 25, 2004 at 02:00 UTC |