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

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




On Jun 3, 2005, at 11:54 AM, Andy Lester wrote:
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}

Ya, that's Pattern 3 from my email.

Grin,

j