# open file, don't do the local $/ trick while () { next if /^\s*print/; next if /^\s*#/; push @lines, $_; }