How do I prevent List::MoreUtils from warning about using $a and $b only once?

Viewed 3026

The List::MoreUtils module indicates that you use the variables $a and $b when supplying the BLOCK that goes with the pairwise function. For example:

use strict;
use warnings;
use List::MoreUtils qw'pairwise';

my @x = ( 1 ..  5);
my @y = (11 .. 15);
my @sums = pairwise { $a + $b } @x, @y;

But when I do that, I get warnings like this:

Name "main::b" used only once: possible typo at try.pl line 7.
Name "main::a" used only once: possible typo at try.pl line 7.

Is there an elegant way to deal with this problem?

Update:

See the answer by Ether for perl v5.19.6 and beyond: problem solved.

6 Answers
Related