in reply to Use of unitialized, why?

Use Data::Dumper. Some of your variables do not contain what you think (or some of your functions/methods do not return what you think).