28 lines
442 B
Raku
28 lines
442 B
Raku
@a = (1, 2, 3);
|
|
@b = (4, 5, 6);
|
|
|
|
sub addem
|
|
{
|
|
my ($ref1, $ref2) = @_;
|
|
|
|
if (ref($ref1) eq "ARRAY" && ref($ref2) eq "ARRAY") {
|
|
|
|
while (@$ref1) {
|
|
|
|
unshift @result, pop(@$ref1) + pop(@$ref2);
|
|
|
|
}
|
|
|
|
return @result;
|
|
|
|
} elsif (ref($ref1) eq "SCALAR" && ref($ref2) eq "SCALAR") {
|
|
|
|
return $$ref1 + $$ref2;
|
|
|
|
}
|
|
}
|
|
|
|
@array = addem (\@a, \@b);
|
|
|
|
print join (', ', @array);
|