You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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);