Try commenting out your undef lines and see what happens. Your code looks correct, but you may be getting some seg faults from the undefs. It looks like your scoping will handle clean-up rather nicely anyway.
It's worth a shot. :) BTW, what platform are you running on? And, how many files are you processing? Does it bomb if you run on 1 or 2 files?
Update: Does it bomb if you comment out your execute statement? Try to see if it's an XML::Parser problem or a DBI problem.
Even if I comment out all the DBI calls and all the undef lines, which in hindsight I should have done from my original post the script segfaults.
It doesnt matter if there is 1..135 ( in my case ). If there is one with an invalid encoding anywhere in the list it will always fail after the last one.