while (<>) { chomp; unless (/^q/i) { print; } else { exit; } }