in reply to errors

Your intent may be expressed more clearly by
while ( <> ) { chomp; last if /quit/i; ... }