programming-examples/perl/Subroutine/Ading two arrays together.pl
2019-11-15 12:59:38 +01:00

17 lines
254 B
Raku

@a = (1, 2, 3);
@b = (4, 5, 6);
sub addem {
local(*array1, *array2) = @_;
while (@array1) {
unshift @result, pop(@array1) + pop(@array2);
}
return @result
}
@result = addem(*a, *b);
print join(", ", @result);