How to assign return values to previously declared variables in Perl? Is there a way to do something like this:
use strict;
use warnings;
my ($a, $b, $c) = first_assign();
# let's say $a = "a", $b = "b", $c = "c"
($a, $b, $c) = second_assign();
# let's say we expect them to be "aa", "bb" and "cc" correspondingly
In this case all these variables will be equal to ''. So, is there some special way to assign to many previously declared at once?
Just return a tuple from your assign methods:
This yields the following output: