while (@array) { my $whatever = shift @array; # process $whatever; }