for (my $x = 0; $x < $#arr; $x++) { my $line = $arr[$x]; ## stuff goes here; }