If there's a next element (i.e. I'm not out of bounds) then I'll grab a value. If there's no next element then I'm done.
This works ..........
but then I thought I'd try ............my $next_version_key = $ordered_list->[($i+1)]->[0] if( $ordered_list->[($i+1)] );
and that added ..........my $next_version_key = $ordered_list->[($i+1)]->[0] || undef;
which meant my list had grown. The next time round, it added ......[] to @{ $ordered_list }
next time round ..............[ undef, {} ]
usw. The same happens if I use ............[ ${\$VAR1->[3][0]}, {} ]
Now, it seems as though $ordered_list->[($i+1)]->[0] is evalutaing to true even though it's out-of-bounds but what strange behaviour!!my $next_version_key = $ordered_list->[($i+1)]->[0] || 0;
Can someone throw some light on that for me? This isn't critical as I'm using ...
which my prefered way .... I'm just interested in the internals with this prob.my $next_version_key = $ordered_list->[($i+1)]->[0] if( $ordered_list->[($i+1)] );
Cheers -Ants
In reply to Array mysteriously growing by AntsPants
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |