in reply to Re: Unexpected behaviour with constant lists and foreach (and closures?)
in thread Unexpected behavior of '..' lists

I ran into this one when I was doing some benchmarking. Specifically, I had something like this:

cmpthese(10000, { 'orig' => sub { foreach my $x ( 0..9, 'a'..'v', 'A'..'V' ) { $x = M +yMod::MapChar($x); }}, 'new' => sub { foreach my $x ( 0..9, 'a'..'v', 'A'..'V' ) { $x = M +yMod::MapChar2($x); }}, } );

I first wrote it without the $x =, but was thinking that this might trigger some void optimization, so I added that part (without thinking about the aliasing implications obviously). This made those subs bomb out with "invalid parameter" errors when they received "10".