|laziness, impatience, and hubris|
Concatenating more than one variable in perlby manoj_speed (Prior)
|on Jun 19, 2014 at 13:45 UTC||Need Help??|
manoj_speed has asked for the
wisdom of the Perl Monks concerning the following question:
I would like to concatenate more than one variable in assignment.
If I want to assign two variables in a single shot. I can use this.
($myvar1, $myvar2) = ('testing1', 'testing2');
Likewise, I would like to use this for two variables concatenation in a single shot.
($myvar1, $myvar2) = ('Hi ', 'Hello');
($myvar1, $myvar2) .= ('Welcome', 'World');
print "$myvar1, $myvar2\n"; # prints Hi, HelloWorld
The above code is doing appending value for variable-2 only.
Is there any possible way to do this in a single statement ?
-- The wisest mind has something yet to learn.