http://qs321.pair.com?node_id=535408


in reply to Array mysteriously growing

With your first method
my $next_version_key = $ordered_list->[($i+1)]->[0] if( $ordered_list->[($i+1)] );
The if is evaluated first, comes out to false, and the $ordered_list->[($i+1)]->[0] is never evaluated.

With your second method, the $ordered_list->[($i+1)]->[0] is evaluated first. Even if this value does not exist, it is autovivified.