in reply to Re: what does rand[] return?
in thread what does rand[] return?

If i repeat execution i get the same reference over and over again for this anon array. I don't know why but that's another problem ;)

I'm not an internals guy but I would guess this is an intentional optimization, though Happy-the-monk may also be correct. It would rely on perl noticing the following things:

Given all that, perl might allocate the array only once and intentionally reuse the same reference on each iteration.

One way to find out might be to modify the loop so it creates a second array reference of the same size and then does something with it like store a reference somewhere, and see if that first array still gets the same address every time.