If you changed the code from
print "$linenumber is: \n" . $linenumber;
to
print '$linenumber is:' . "\n" . $linenumber;
or
print '$linenumber is:' . "\n$linenumber";
he will print
$linenumber is: 22
What I find useful when I want to print the variable name is to use single quotes so that the variables inside are not translated into their value, which makes it easier to read the code.
source share