Think about Loose Coupling | |
PerlMonks |
Re: Re: Re: Re: Context aware functions - best practices?by sauoq (Abbot) |
on Jan 15, 2003 at 22:56 UTC ( [id://227264]=note: print w/replies, xml ) | Need Help?? |
That's obviously a list-context function, and you don't expect it to do anything useful at all in scalar context. You make a good point here. Some functions just shouldn't be expected to do anything useful in scalar context. A nice idiom for writing such functions is to start them with wantarray or return undef. -sauoq "My two cents aren't worth a dime.";
In Section
Seekers of Perl Wisdom
|
|