On Sat, Apr 28, 2012 at 12:16:57PM -0400, Shawn H Corey wrote:
> On 12-04-28 12:10 PM, Jim Gibson wrote:
>>
>> On Apr 28, 2012, at 9:04 AM, sono...@fannullone.us wrote:
>>
>>> my $host = 'localhost';
>>>
>>> if ( defined ($mail_field) and ($mail_field ne '') ) {
>>>     $host = $mail_field;
>>> }
>>
>> I would use:
>>
>> my $host = $mail_field ? $mail_field : 'localhost' ;
>>
>>
>
> Well, since $mail_field is not likely to be false unless it's undefined:
>
> my $host = $mail_field || 'localhost';

Good solution++

Clear, easy to read, easy to understand. 

-- 
            Michael Rasmussen, Portland Oregon  
      Other Adventures: http://www.jamhome.us/ or http://westy.saunter.us/
Fortune Cookie Fortune du courrier:
All that we need to make us happy is something to be enthusiastic about.
    ~ Albert Einstein

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