On Sun, 6 Aug 2000 18:28:29 -0800, Michael Fowler wrote:
>> print $pw;
>> print scalar $pw;
>
>These resulting in a $pw->STRINGIFY or $pw->TO_STRING call is also
>confusing; neither are being used as strings.
Oh yes they are.
$^W = 1;
my $x;
print $x;
This complains of a "use of uninitialized value". When does this happen?
When the undef is converted to a string.
$y = 2*3;
print $y;
Does this print a number, or a string? It prints the result of the
calculation, a number, as a string. After this, the string value of $y,
"6", will even be cached as a string inside $y.
I could go on. Printing a list will convert every single list item into
a string.
This also clearly points out another reason why "turning into a scalar"
and "turning into a string", or into a list of strings, is not the same
thing.
--
Bart.