perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew O'Brien" <andr...@oriel.com.au>
Subject RE: Sort Keys of Hash Printed via dump
Date Thu, 03 Sep 2009 03:21:39 GMT

> -----Original Message-----
> From: Thompson, John [mailto:jthomp@midwestern.edu] 
> Sent: Thursday, 3 September 2009 6:07 AM
> 
> Is there any variable that I can set that would tell dump to 
> sort the keys of a hash alphabetically (Like Data::Dumper)?

Not as far as I can see from the docs.

But, then again, it's a trivial thing to write your own sub that does
this. A completely untested example to simulate the default behavior :-

[!
  use Data::Dumper;
 !]
[$ sub sorted_dump $]
<pre>
[+ do { local $Data::Dumper::Sortkeys=1; Dumper( @_ ); } +]
</pre>
[$ endsub $]

Cheers,

Andrew

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message