You've been given many comments and suggestions, so I won't second them.
What I find most upsetting with the code though is that it doesn't localize FH and $_. That is bad, bad, bad. Forgetting to localize $_ is far too common. See Localizing $_ and while (<FH>) { ... }. (Is really: "Re: Re4: matching every occurrence of a regex") for a brief list of (core/common) modules that at that time didn't localize $_--potentially causing bugs in the user's program.
ihbIn reply to Re: Bad Module Code
by ihb
in thread Bad Module Code
by CodeJunkie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |