in reply to Re: Re: An anomaly with List::Util::reduce and/or eval?
in thread An anomaly with List::Util::reduce and/or eval?

I thought the same thing, but it doesn't seem so:
#!/usr/bin/perl -w use List::Util qw[ reduce ]; print reduce{ print "a = '$a', b = '$b'\n"; eval "showcontext($a + $b) +";} 1,2,3; sub showcontext { print "Context: "; if (wantarray) { print "array\n"; } elsif (defined(wantarray)) { print "scalar\n"; } else { print "void\n"; } $_[0]; }
produces:
$ perl /tmp/t76
a = '1', b = '2'
Context: scalar
Use of uninitialized value in concatenation (.) or string at /tmp/t76 line 5.
a = '', b = '3'
Use of uninitialized value in concatenation (.) or string at /tmp/t76 line 5.
Context: scalar
3