On Sun, Jun 20, 2010 at 04:41, philge philip <philg...@yahoo.com> wrote: > hi > > can someone tell me how i can sort by keys from a hash (huge data) stored > using Data::Dumper? snip
Data::Dumper can be configured through the use of its package variables (or methods if you are using the OO version). For instance: #!/usr/bin/perl use strict; use warnings; use Data::Dumper; $Data::Dumper::Sortkeys = 1; $Data::Dumper::Useqq = 1; $Data::Dumper::Indent = 1; $Data::Dumper::Terse = 1; print Dumper { foo => 1, bar => undef, baz => [ "\t", "\0", " ", "\r", "\n" ], }; produces: { "bar" => undef, "baz" => [ "\t", "\0", " ", "\r", "\n" ], "foo" => 1 } Compare with the default (note, key order is not guaranteed): $VAR1 = { 'bar' => undef, 'baz' => [ ' ', '', ' ', ', ' ' ' ], 'foo' => 1 }; I particularly like what "\r" does to its line in the default. -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/