[Omaha.pm] precedence: ?: vs. =

Jay Hannah jay at jays.net
Fri Jun 3 09:56:27 PDT 2005


On Jun 3, 2005, at 11:54 AM, Andy Lester wrote:
> On Fri, Jun 03, 2005 at 11:48:53AM -0500, Jay Hannah 
> (jhannah at omnihotels.com) wrote:
>>
>> This doesn't do what the author was expecting:
>>
>>   $_[1] ? $prop_to_ping = $_[1] : $prop_to_ping = $_[0]->{prop};
>
> That's not how you should be using the ternary.  You're using it as a
> glorified if/then.  You really want.
>
> $prop_to_ping = $_[1] ? $_[1] : $_[0]->{prop}

Ya, that's Pattern 3 from my email.

Grin,

j




More information about the Omaha-pm mailing list