Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: assigning the maximum of two numbers

by xdg (Monsignor)
on Nov 03, 2005 at 03:42 UTC ( [id://505209]=note: print w/replies, xml ) Need Help??


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
    No wonder people hate perl. :-(

    I work with people who would *USE* that, too. :-(

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://505209]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2024-04-18 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found