my $valid; while () { chomp; next if /INVALID/; $valid .= $_; }