Data::Dumper How to quote keys while dumping

K

kamal

I am trying to dump a hash using Data::Dumper.
I need to quote the keys while dumping.

My progarm looks like this

use Data::Dumper;
$Data::Dumper::Quotekeys = 1;
$Data::Dumper::Useqq = 1;

my %tmp ;

$tmp{'1'} = "l";
$tmp{'2'} = "u";

open (STDOUT, ">");
print STDOUT Data::Dumper->Dump([\%tmp], ['*tmp']);
close STDOUT ;
---------------------------------------------------
Output
%tmp = (
1 => "l",
2 => "u"
);

---------------------------------------

i need it as

%tmp = (
'1' => "l",
'2' => "u"
);

Can anyone help out with this

Thanks
Kamal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top