use Data::Dumper; local $Data::Dumper::Sortkeys = \&dumper_filter; sub dumper_filter { my ($hash) = @_; return [(sort {lc $a cmp lc $b} keys %$hash)]; } my $d = Data::Dumper -> new ([\%ENV]); print '
' . $d -> Dump . '
';