K
ko
Purl said:John W. Krahn wrote:
(snipped)
Ok, you got me on this one. I am reading Perl Cookbook,
Chapter 11 on taking references to scalars. I have not
yet found any notes on this oddity.
Would you mind helping me to understand how your final
printed sum is generated? Otherwords, where is your
number 135267140 originating?
I am running tests,
$stupid = \55;
print $stupid;
print "\n";
print $stupid + 0;
Naturally my numbers are different but I cannot understand
how the base number is created. My local results are:
SCALAR(0x1765654)
24532564
So, where the heck is your number and my 24532564 originating?
Thanks,
Purl Gurl
Automatic string to number conversion. The scalar's *memory* address is
converted from its hexadecimal representation to decimal:
perl> $a = \55;
perl> print "$a\n";
SCALAR(0x1ac65f0)
perl> print $a + 0, "\n";
28075504
perl> printf("%d\n", 0x1ac65f0);
28075504
HTH - keith