while (($line = <>) && $line =~ /\S/) { ... } while (($line1 = <>) && ($line2 = <>)) { ... }