What is the difference between these two constructs in Perl?

Jackie

New member
What is the difference between these two constructs in Perl?
$var = “$filename.$suffix”;
$var = “$filename” . “$suffix”;
 
Why don't you try them both and see what happens!?!
The first one includes the period in the result, while in the second one the period is just the concatenate operator. The second one is ugly and inelegant;
$var = $filename . $suffix;
is much cleaner and doesn't waste time putting the variables into strings before the concatenation.

P.S. "Real" Perl programmers use the qq{} operater rather than double-quotes.
 
Back
Top