in reply to How do I remove blank lines from text files?
This allows you to use a normal loop construct (makes sense to me) and short-circuit it at the beginning if certain conditions are met. It makes cleaner code than a lot of if-elsif statements.while (<FILE>) { next if /^#/; # skip lines starting with comments next unless /\S/; # do something with a real line here }
|
|---|