Created
April 23, 2014 10:25
-
-
Save knutov/11210007 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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