Subject: | perl 5.23.5 simultaneous min,max wrong results |
Date: | Fri, 11 Dec 2015 10:16:49 +1100 |
To: | bug-Scalar-List-Utils [...] rt.cpan.org |
From: | Kevin Ryde <user42_kevin [...] yahoo.com.au> |
In my build of perl 5.23.5 on recent debian i386 and its supplied
List::Util 1.42_01, a program
use strict;
use List::Util 'min';
my $x = 7;
my $y = 3;
print "$x, $y\n";
($x,$y) = (min($y), min($x));
print "$x, $y\n";
prints
7, 3
3, 3
where I expected it to be
7, 3
3, 7
which is what previous perl versions have given. I struck this digging
around for
https://rt.cpan.org/Ticket/Display.html?id=109700
I don't know if the fault lies in List::Util or in perl. Omitting the
"min" so a plain swap ($x,$y) = ($y,$x) seems ok. Could something hairy
happen on passing through min() ?