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

RE: [Omaha.pm] if ($a > $b) { $b = $a }



"Tegels, Kent" wrote:
> Well, there's the dreaded:
> $b = ($a > b$ ? $a : $b);
>
> But that's less readable than what you have.

This expression returns the maximum of $a and $b:

    [ $a => $b ] -> [ $a <= $b ]

Though less readable than your version, it's more enjoyable to read. :-)
As much as I like it, I can't recommend it for production code.

Hugh



		
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.com