On 12-04-28 12:36 PM, Uri Guttman wrote:
that reduces to just:
my $host = $mail_field || 'localhost' ;
which is the classic defaulting style. it has one flaw, it makes '' and
0 not allowed for values in $mail_field. but i doubt those would ever be
good host names so it should be fine here. you can switch the || to //
as someone said to get defined semantics in recent perls.
i am surprised not to have seen this classic idiom mentioned in the
thread so far.
Because the OP was calling it $xtra, which could be anything. Once he
switched to $mail_field, it became clear that is cannot contain any
variation of false, not just undef. Moral of the story: use meaningful
variable names.
--
Just my 0.00000002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
[updated for today's programmers]
"Show me your code and conceal your interfaces, and I shall continue
to be mystified. Show me your interfaces, and I won't usually need
your code; it'll be obvious."
-- Fred Brooks
Don't be clever; being great is good enough.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/