my $count = 10; while ($count) { #do something to array print $array[$count--]; } # alternative $count =0; for (@array) { print "$count $_\n"; # $_ is the current array item $count = &something_complex; }