On 04/28/2012 01:28 PM, Shawn H Corey wrote: > 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. good point. i skimmed most of this thread until the last few posts. i always teach the importance of good name choices. it is the most important aspect of coding for humans (computers don't care much about names :). uriThread Previous | Thread Next