manoj_speed has asked for the wisdom of the Perl Monks concerning the following question:
Hi All,
I would like to concatenate more than one variable in assignment.
For Ex:
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 ?
I would like to concatenate more than one variable in assignment.
For Ex:
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.
Back to
Seekers of Perl Wisdom