First, did you use $Data::Dumper::Useqq=1; when using Data::Dumper? (or just use Data::Dump) That will make it easier to spot any funny control characters.
The problem with helping you out is that we need to be able to reproduce the issue. You'll need to boil down your code and input to something that still runs and reproduces the same issue and post it here; see also http://sscce.org/. If the sample input data is too large, you can try replacing it with some code that generates enough fake input data to reproduce the same problem.