in reply to Truth & Whitespace

A module may be overkill when you can just use an operator
$name = ( defined $nickname ) ? $nickname : ( defined $salutation and defined $last_name ) ? "$saltutation $last_name" : 'Guest';
See. ?: (trinary conditional operator) in perlop.
HTH

_________
broquaint

Replies are listed 'Best First'.
Re: Re: Truth & Whitespace
by PodMaster (Abbot) on May 02, 2003 at 19:25 UTC
    I'd much rather write that as
    $name = defined $nickname ? $nickname : defined $salutation && defined $last_name ? "$salutation $last_name" : 'Guest';
    In my opinion it's much more pretty readable (and pretty) ;)


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests.
    ** The Third rule of perl club is a statement of fact: pod is sexy.