in reply to Different result for 'foreach' vs 'while shift' arrayref
They are not equivalent.
Something in your arrayref (namely the 788426th item) evaluates to 0 or another false value, so your while loop ends there. Consider
my @ary = ( 1, 6, 0, 2, 3 ); while ( my $result = shift( @ary ) ) { print "$result\n"; }
Output:
1 6
|
|---|