for (my $i = 0; $i <= $#array; $i++) { # index is in $i # element is in $array[$i]; }