Bug#487262: reduce/pairwise combo doesn't work

Anthony DeRobertis anthony at derobert.net
Fri Jun 20 16:42:27 UTC 2008


Package: liblist-moreutils-perl
Version: 0.21-1
Severity: normal
File: /usr/lib/perl5/List/MoreUtils.pm

It'd be nice if this worked:

use List::Util qw/reduce/;
use List::MoreUtils qw/pairwise/;
use strict;
my $data = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
my $total = reduce { [ pairwise { $a + $b } @$a, @$b ] } @$data;
print join(", ", @$total), "\n";

expected:
12, 15, 18

got:
Can't use string ("3") as an ARRAY ref while "strict refs" in use at /tmp/foo.pl line 5.

It looks like the localization of $a and $b isn't working correctly, and
reduce's $a and $b are being messed up. I tried RTFS, but I don't
understand why it's happening.

I tried with perl 5.10.0-10 (debian testing), and same error.

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.22-4-686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages liblist-moreutils-perl depends on:
ii  libc6                  2.3.6.ds1-13etch5 GNU C Library: Shared libraries
ii  perl                   5.8.8-7etch3      Larry Wall's Practical Extraction 
ii  perl-base [perlapi-5.8 5.8.8-7etch3      The Pathologically Eclectic Rubbis

liblist-moreutils-perl recommends no packages.

-- no debconf information





More information about the pkg-perl-maintainers mailing list