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