Hi,
Is there any advantage in the assignment operation
$dest = "$src" over
$dest = $src ?
And then, are the following operations identical?
$dest = "$varA:$varB:$varC";
$dest = join ":", $varA, $varB, $varC;
Regards,
--Rakesh
Late to this, I see you got your answer, but have some stuff to add.
I don't think your question is if there is an advantage of
$dest = "$src" over
$dest = $src ?
is it?
To answer your question, you have to answer this question.
Isin't it really a question of what is a '$var' Perl data type?
I know it sounds trivial, but sooner or later this will come
up again and again. Like take boolean's for example.
This should lead you to the docs on data types, 'perldata'.
Its better to get the full picture instead of a thread of info
at a time.
perldata:
-----------------
Perl has three built-in data types:
scalars, arrays of scalars, and associative arrays of scalars,
known as "hashes".
'Scalar Values'
All data in Perl is a scalar, an array of scalars, or a hash of scalars.
A scalar may contain one single value in any of three different flavors:
a number, a string, or a reference.
In general, conversion from one form to another is transparent.
Although a scalar may not directly hold multiple values, it may contain
a reference to an array or hash which in turn contains multiple values.
....
Although strings and numbers are considered pretty much the same thing
for nearly all purposes, references are strongly-typed, uncastable
pointers with builtin reference-counting and destructor invocation.
....
---------------
So given that last part about references, it would throw a monkey wrench
in the notion that $var and "$var" are always equal.
Who knows, using booleans, you may run into context situations:
65 == "65" true
65 eq "65" true
65 eq "A" false
65 == "A" warning, "A" is not a digit
-sln