[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-Forum] Conditional operator problem



At 12:02 PM 6/12/00, Campbell-Lange wrote:
>I am having some difficulty using the ?: notation on MacPerl 5.2.0r4.
[snip]>
>set $reply :    $reply = $subject =~ /Re:/;
>option 1   : if ($reply eq 1) { $reply = '+' } else {$reply = 'Ý'};
>option 2   :    ($reply eq 1) ? $reply = '+' : $reply = 'Ý';
>
>I note that the pod says 'The operator may be assigned to if both the 2nd and
>3rd arguments are legal lvalues'.
>

See Ronald's reply, and why even assign the truth value to $reply in 
the first place? :-)

$reply = $subject =~ /Re:/ ? '+' : 'Ý';

-- 

- Bruce

__Bruce_Van_Allen___bva@cruzio.com__Santa_Cruz_CA__

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-forum-request@macperl.org