in reply to Brain Teaser
Update: added <READMORE> to let others have fun too ;-)
Why does it evaluate to zero
It does not ;-) add a print "\n"; after that and you'll see.
Meaning:
Since references return memory addresses when accessed as numbers, the last line will result in some value close to 1, just a little smaller (this is because (1) is allocated before (2)).
Anyway, that's my guess. Anyone care to point my mistakes?
-mk
It does not ;-) add a print "\n"; after that and you'll see.
Meaning:
print //; # pattern-match an empty string. result: 1 print \\//; # ref to ref to variable holding 1 (1) print \\\//; # ref to ref to ref to variable holding 1 (2) print \\///\\\//; # print (1) / (2)
Since references return memory addresses when accessed as numbers, the last line will result in some value close to 1, just a little smaller (this is because (1) is allocated before (2)).
Anyway, that's my guess. Anyone care to point my mistakes?
-mk
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Brain Teaser
by srawls (Friar) on Jun 10, 2001 at 23:10 UTC | |
by nysus (Parson) on Jun 10, 2001 at 23:24 UTC |
In Section
Meditations