Mega Code Archive

 
Categories / Perl / Regular Expression
 

Skip blank lines and comments

#!/usr/bin/perl use warnings; use strict; while (<>) {     chomp;   # strip trailing linefeed from $_     next if /^(\s*(#.*)?)?$/;   # skip blank lines and comments     print "Got: $_ \n"; }