in reply to assigning the maximum of two numbers
So, can you think of any other ways, and are any of them faster than List::Util?
I think this is elegant...
I don't know how it would compare, but I'd expect favorably. I, like Aristotle, am not interested in the efficiency difference enough to benchmark.sub max { $_[ $_[0] < $_[1] ] }
By the way, you can use that technique inline and avoid the function call (if you are really trying for efficiency.)
my $max_xy = ($x,$y)[$x<$y]
-sauoq "My two cents aren't worth a dime.";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: assigning the maximum of two numbers
by xdg (Monsignor) on Nov 03, 2005 at 03:42 UTC | |
by Anonymous Monk on Nov 03, 2005 at 22:53 UTC | |
|
Re^2: assigning the maximum of two numbers
by EvanCarroll (Chaplain) on Nov 03, 2005 at 03:09 UTC | |
by GrandFather (Saint) on Nov 03, 2005 at 03:30 UTC | |
by ikegami (Patriarch) on Nov 04, 2005 at 20:15 UTC |