Besides the other comments already in this thread, let me add a few of my own:
- If you used the name - instead of display, you wouldn't need to special case
anything in the code. It'd just work. Remember, when possible, stay
with normal conventions, and then the programming support comes cheap or free.
- You might be stripping more than just comments. You'll also be killing
any line that starts with # inside a here-doc. Solving this problem is
impossible for the general case, however. So document it as a limitation.
- You have an undocumented feature of not stripping any lines that begin
with #!. Either update the code or the docs.
-- Randal L. Schwartz, Perl hacker