#!./perl sub minmax { eval '@_ = sort { $a '.shift().' $b } @_'; (shift, pop(@_)); } ($x, $y) = &minmax('<=>', 2, 4, 1, 0, 3); print "x = $x, y = $y\n"; ($x, $y) = &minmax('cmp', "foo", "bar", "zot", "xyzzy"); print "x = $x, y = $y\n";