s/#.*$//; next if /^$/;
That'll probably bite you eventually. Consider these lines from an imaginary configuration file:
# Set the format for currency: currency_format = '$###.##';
Skipping comment-only lines right off the bat is an optimization. Other lines will probably require smarter parsing.
Even if the file format guaranteed that your method could be used safely, I wouldn't use it. Why do an expensive substitution on lines you are going to throw out? I'd do it like this:
next if /^\s*#/; s/#.*$//;
We've probably strayed quite a bit from the OP's needs though.
-sauoq "My two cents aren't worth a dime.";
In reply to Re: Re: Re: Re: Regular Expressions to ignore lines starting with #
by sauoq
in thread Regular Expressions to ignore lines starting with #
by lanier
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |