Hello again, Mitch! To expound on my anonymous brother's answer, what you're doing here:
my $deux = $toto, print "\n", $tutu;
is assigning $toto to $deux, and then executing print "\n", $tutu. In order to embed a newline in $deux, you could do either of the following:
$deux = "$toto\n$tutu"; # variable interpolation in double-quot
+ed strings
$deux = $toto . "\n" . $tutu; # string concatenation
Of course, if you merely care about printing, the following will also work:
print $toto, "\n", $tutu;
This works because print is a list operator that can take an arbitrary number of arguments -- but you can't do the same when assigning to a scalar, you have to use either interpolation or string concatenation (the . operator).
|