diff options
Diffstat (limited to 'Bugs/minmax')
-rw-r--r-- | Bugs/minmax | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Bugs/minmax b/Bugs/minmax new file mode 100644 index 0000000000..4251f81587 --- /dev/null +++ b/Bugs/minmax @@ -0,0 +1,12 @@ +#!./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"; + |