Skip to content

Instantly share code, notes, and snippets.

@knutov
Created April 23, 2014 10:25
Show Gist options
  • Save knutov/11210007 to your computer and use it in GitHub Desktop.
Save knutov/11210007 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use v5.14;
# cpanm utf8::all Data::Dumper::Perltidy Data::Dumper
use utf8::all;
#===========
# TODO: move to standalone module
use Data::Dumper::Perltidy;
# use Data::Dumper;
$Data::Dumper::Useqq = 1;
{
no warnings 'redefine';
sub Data::Dumper::qquote {
my $s = shift;
return "'$s'";
}
}
# $Data::Dumper::Indent = 3;
$Data::Dumper::Sortkeys = sub {
my $data = join '', keys %{$_[0]};
if ($data !~ /^[0-9]+$/) {
# input is not numeric
return [ sort keys %{$_[0]} ];
} else {
return [ sort { $a <=> $b } keys %{$_[0]} ];
}
};
#===========
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment