in reply to printing hash
It would be easier to answer your question if you could show us the relevant parts of your code. It's hard to tell what's going on from what you've told us so far. See How (Not) To Ask A Question.