Friday, May 16, 2014

How can you detect comment or blank line in a file?

open (FH, "$File") || die "Can't open $File - $!\n";
while (<FH>) {
    chomp;
    if ($_ =~ /^(#|;|$)/) {
        print "Found Blank-Line or Commented-Line @ line - #$.\n";
    }
}
close (FH);