print OUTFILE map { my $s = $_; $s =~ s/\s*#.*/; $s } grep { !/^\s*#/ } ;