This works perfect although I don't understand yet 100% how the Schwartzian transform works.
Their is one small problem that I have with the code is that it should look for all leading characters to be split because now it substr only one but it could be more. (CR30-1 for example) So I tried to modify the code but no success.
sub sorted {
return map { $_->[0] }
sort {
$a->[1] <=> $b->[1] ||
$a->[2] <=> $b->[2]
} map { [ $_, split("-", s/^[A-Z]+//) ] } @_;
}
foreach my $key (sorted(keys %keys)) {
print "'$key' => ", $keys{$key}, "\n";
foreach my $subkey (sorted(keys %{$keys{$key}})) {
print " '$subkey' => $keys{$key}->{$subkey}\n";
}
}