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

Andy Lester andy at petdance.com
Fri Jun 3 09:54:24 PDT 2005


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}

xoxo,
Andy

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


More information about the Omaha-pm mailing list