Perl allows me to assign data to a bunch of new variables in one line. For example, from a string:
Code: Select all
$data = 'Dave,46,sr. engineer,colorado,23';
($name, $age, $title, $city, $code) = split(',',$data);
Code: Select all
($var1,$var2,$var3) = @myArray;
Conversely, is there a way to take a bunch of variables and make a list out of them without having to manually put commas between them? e.g., rather than this:
Code: Select all
put variable1 &comma& variable2 &comma& variable3 &comma& variable4 &comma& variable5 into theList
Code: Select all
put variable1, variable2, varible3, variable4, variable5 into the items of theList
--(or)
put createList(variable1, variable2, varible3, variable4, variable5) into theList
Updated to include solutions: Here