I have a hash which has around 20 Key Value Pairs. I want to print these values in a file and on screen in such a way that the indentation is not lost. I want to print it in mysql query output format. The Keys will be name of parameter and below it the value of the key has to be printed. I tried with sprintf but it's not a success. The keys length are different and so it he value length. What is the best possible solution?