Is there a different way to concatenate variables in Perl?
I accidentally wrote the following line of code:
print "$linenumber is:
" . $linenumber;
And that resulted in output like:
22 is:
22
I was expecting:
$linenumber is:
22
So then I wondered. It must be interpreting the $linenumber
in the double quotes as a reference to the variable (how cool!).
What are the caveats to using this method and how does this work?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…