in reply to perl help sort
If it's just three numbers, here's a "snazzy" solution (for some definition of snazzy):
my($x,$y,$z) = (11, 9, 12); print [[$x=>$y]->[$y<=$x]=>$z]->[$z<=[$x=>$y]->[$y<=$x]];
Hey, I'm only kidding. Actually, [$x => $y]->[$x <= $y] was posted on clpm (see original here) as Perl's built-in max function. I just adapted it for 3 variables (reducing the efficiency even further, but maintaining reasonable symmetry :-)
|
|---|