Is there a different way to concatenate variables in Perl?
I accidentally wrote the following line of code:
print \"$linenumber is: \\n\" . $linenumb
In Perl any string that is built with double quotes will be interpolated, so any variable will be replaced by its value. Like many other languages if you need to print a $
, you will have to escape it.
print "\$linenumber is:\n$linenumber";
OR
print "\$linenumber is:\n" . $linenumber;
OR
printf "\$linenumber is:\n%s", $linenumber;
Scalar Interpolation