while (<$fh>)
You should always put local($_); before such a loop, because the global variable $_ is set to each line and is not cleaned up in the end.
Update: http://perl.plover.com/local.html has an example of the dangers of this kind of while loop.
In reply to Re^2: Cleaning up a text file with compact regex
by betterworld
in thread Cleaning up a text file with compact regex
by neversaint
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |