Is there a different way to concatenate variables in Perl?
I accidentally wrote the following line of code:
print \"$linenumber is: \\n\" . $linenumb
If you change your code from
print "$linenumber is: \n" . $linenumber;
to
print '$linenumber is:' . "\n" . $linenumber;
or
print '$linenumber is:' . "\n$linenumber";
it will print
$linenumber is:
22
What I find useful when wanting to print a variable name is to use single quotes so that the variables within will not be translated into their value making the code easier to read.