perl switch statement limitation
Look at the documentation for the Perl switch statement. Look down the bottom at the "limitations" section. Look at the last limitation.
If your source file is longer then 1 million characters and you have a switch statement that crosses the 1 million (or 2 million, etc.) character boundary you will get mysterious errors. The workaround is to use smaller source files.
P.S. I recently created a nerdy privacy-respecting tool called When Will I Run Out Of Money? It's available for free if you want to check it out.