@arr = ( 1, 2, 3 ); for my $x ( @arr ) { print "Shifting\n"; shift @arr; print "count: " . scalar @arr; print "data: @arr\n"; } print "\ndata: @arr";