use strict; use warnings; use 5.010; use List::MoreUtils qw{ pairwise }; my @arr1 = (10, 20, 30); my @arr2 = (1, 1, 1); my @totals = pairwise {$a + $b} @arr1, @arr2; --output:-- Name "main::b" used only once: possible typo at 2perl.pl line 12. Name "main::a" used only once: possible typo at 2perl.pl line 12.