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

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



On Fri, Jun 03, 2005 at 11:48:53AM -0500, Jay Hannah (jhannah@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}

xoxo,
Andy

-- 
Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance