I have a function like
sub multi_return {
my ($val1, $val2) = ('','');
#does something
return ($val1, $val2);
}
Is there a way I can concatenate both returned vales with different string variables without having to use temporary variables?
my $string1 = 'some text';
my $string2 = 'some other text';
my ($tmp1,tmp2) = multi_return();
$string1 .= $tmp1;
$string2 .= $tmp2
undef($tmp1);
undef($tmp2);
This does not work
($string1, $string2) = multi_return();
Edit:
More generally, I'm searching for a way to concatenate two lists of strings, where both lists have the same length. The strings on the same positions of each list should be concatenated.
I guess the second part of @amon's answer serves my purpose.