http://www.perlmonks.org?node_id=128407


in reply to How do I strip lines prefixed by a "#"

This bypasses lines where # is in column 1 and blank lines.
STLOAD: foreach $line (<INFILE>) { chomp $line; $line_header = substr($line, 0, 1); # Ignore comments (#) and blank lines # including 0-n spaces. if ($line_header eq '#' || $line =~ /^ *$/) { next STLOAD; } elsif ($line_header eq '@') { # Specifies: targ host, path, file $ts_cnt ++; if ($ts_cnt > 1) ...