BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:
Is this another reduce bug or am I missing something?
#! perl -slw use strict; use List::Util qw[ reduce ]; my $s = 'this is a test'; reduce{ print "$a:$b"; $b; } split ' ', $s; print "\n---\n"; my @p; reduce{ print "$a:$b"; push @p, [ 1, 2 ]; $b; } split ' ', $s; print "\n---\n"; my @q; reduce{ print "$a:$b"; push @q, [ $a, 2 ]; $b; } split ' ', $s; print "\n---\n"; my @r; reduce{ print "$a:$b"; push @r, [ $a, $b ]; $b; } split ' ', $s; __END__ c:\test>junk3 this:is is:a a:test --- this:is is:a a:test --- this:is is:a a:test --- this:is Use of uninitialized value in concatenation (.) or string at c:\test\j +unk3.pl line 31. :a Use of uninitialized value in concatenation (.) or string at c:\test\j +unk3.pl line 31. :test
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Another reduce bug?
by wind (Priest) on Aug 16, 2007 at 02:31 UTC | |
by BrowserUk (Patriarch) on Aug 16, 2007 at 02:43 UTC | |
by tye (Sage) on Aug 16, 2007 at 03:51 UTC | |
|
Re: Another reduce bug? (noinc)
by tye (Sage) on Aug 16, 2007 at 02:32 UTC |