# while (not eof FILE) { ... } # or... until (eof FILE) { my (@lines) = map scalar , 1 .. 3; # work with $lines[0], $lines[1], $lines[2] }