Comment out half your code. If the problem goes away it was in the chunk you commented out. If the problem remains it's in the uncommented code. Iteratively apply the technique to narrow in on the problem code.
Perl is the programming world's equivalent of English