|
Lets try to output some of our new variables....The following code prints the string "nuts and bolts" using concatenation:
$a = 'nuts';
$b = 'bolts';
print $a.' and '.$b;
It would be nicer to include only one string in the final print statement, but the line
print '$a and $b';
prints literally $a and $b which isn't very helpful. Instead we can use the double quotes in place of the single quotes:
print "$a and $b";
The double quotes force interpolation of any codes, this causes Perl to evaluate the values of the $a and $b variables.
Other codes that are interpolated include special characters such as newline and tab. The code \n is a newline and \t is a tab. 
|