in reply to Do you consider these different or the same?

Sorry for editing this post so much, but I changed my mind a minute after posting and no one had replied to it yet:

These are topologically different:

my $ar1=[$x,$x]; my $ar2=[$y,$z];

But these are the same:

my $ar3=[$x,$x]; my $ar4=[$y,$y];

That is, the comparison should care about the addresses of the references, but it should care about loops. Another way of looking at it is: deeply equivalent references should have the same canonical representation when dumped. Compare the following:

# $ar1 $VAR1 = [ {}, $VAR1->[0] ]; # $ar2 $VAR1 = [ {}, {} ]; # $ar3 $VAR1 = [ {}, $VAR1->[0] ]; # $ar4 $VAR1 = [ {}, $VAR1->[0] ];