Odd.
My guess would be that some of the data in @results is not formed in the way that you expect.
A couple of suggestions:
- Use Data::Dumper::Simple to dump the contents of @results before you enter the foreach loop. This should show you if you have any malformed data.
- Does the data include newlines? Maybe you simply need to chomp
- Post a sample of the data that is causing it to fail as you describe.
Cheers,
Darren :)