while( @array ) { my $x = shift @array; # use $x. }