in reply to Re: assigning the maximum of two numbers
in thread assigning the maximum of two numbers
my $max_xy = ($x,$y)[$x<$y]
That reminds me about a variation of this gem I seem to remember being in Effective Perl Programming. Not as efficient, but more artistic. If I remember correctly, it's like this:
my $max_xy = [$x=>$y]->[$x<=$y];
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: assigning the maximum of two numbers
by Anonymous Monk on Nov 03, 2005 at 22:53 UTC |