Dear Monks,
I just found out that anonymous hashes do not have a stable address throughout program execution :
use Scalar::Util qw(refaddr);
for (1 .. 10) {
print refaddr { foo => 1 }, "\n";
}
The above fragment of code prints out adresses that seem to run in a cycle of 3 :
4303377064
4303375648
4303377184
4303377064
4303375648
4303377184
4303377064
4303375648
4303377184
4303377064
I guess this is due to some compilation internals. But still, I found it puzzling. I was naively expecting an anonymous hash to be compiled once and for all at a given place.
I wonder if some monk has an insight on this ?