while (<>) { next if ( /^\s*;/ ); # skip if first non-space char is ";" # now do stuff... }