in reply to Avoiding silly programming mistakes
(Yes - every single piece of code I write has warnings throwing fatal errors.)package XXX; use strict; use warnings FATAL => 'all'; 1; __END__
What these two practices do make it very easy to find the lines that have caused any problem. They would have made it very easy to find your error and they make it very easy to find other errors, too.
There's a number of other practices that help as well, but those are for another post.