in reply to Re: min $#a, $#b > $#b
in thread min $#a, $#b > $#b

Adding scalar seems to fix it..
use List::Util qw( min ); my @one = (1); for my $_in (1..5) { push @_x, "$_in"; my $x_max = min scalar($#_x), $#one; print "SET my \$x_max $x_max = min \$#_x $#_x, \$#one $#one;\n"; } SET my $x_max 0 = min $#_x 0, $#one 0; SET my $x_max 0 = min $#_x 1, $#one 0; SET my $x_max 0 = min $#_x 2, $#one 0; SET my $x_max 0 = min $#_x 3, $#one 0; SET my $x_max 0 = min $#_x 4, $#one 0;

Though I don't quite understand why. Real bug perhaps?

Replies are listed 'Best First'.
Re^3: min $#a, $#b > $#b
by Eily (Monsignor) on Jan 13, 2016 at 08:55 UTC

    Actually anything that will initiate a new value instead of just forwarding the current one will work (like adding quotes around the variable, 0+$var, or even scalar($var), though I wasn't actually expecting this one), because the new value won't have the same magic. I did think about forcing a copy of some variables (which explains the quotes in some parts of my code), but since I had been working on the issue for a while (I started with much bigger code, I reduced it trying to find the bug), I wasn't sure at the time of my post whether I was doing some kind of silly mistake, and I never thought about forcing the copy on the parameters of min. Thanks for the answer !

Re^3: min $#a, $#b > $#b
by FreeBeerReekingMonk (Deacon) on Jan 12, 2016 at 21:11 UTC

    yup, real bug. happens in v5.20.2