Data::Dumper How to quote keys while dumping

Discussion in 'Perl' started by kamal, Aug 12, 2003.

  1. kamal

    kamal Guest

    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
    kamal, Aug 12, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    13,134
  2. Stimp
    Replies:
    2
    Views:
    2,229
    Stimp
    Sep 20, 2006
  3. kamal
    Replies:
    5
    Views:
    115
    James E Keenan
    Aug 13, 2003
  4. Replies:
    4
    Views:
    228
    Paul Lalli
    Aug 1, 2007
  5. John
    Replies:
    0
    Views:
    85
Loading...

Share This Page