Data::Dumper How to quote keys while dumping

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kamal

    Data::Dumper How to quote keys while dumping

    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
Working...