in reply to Empty variables in insertion in mongodb
The advice in brian's Guide to Solving Any Perl Problem might help you.