I tried out your glob approach at number generation to understand it. Thanks for posting. I'm always trying to learn more about the usage of glob(). I found I could simplify your $globStr declaration like this:
use warnings;
use strict;
my $digit_pattern = '{0,1,2,3,4,5,6,7,8,9}' x 4;
print "$_\n" foreach glob $digit_pattern;
When I saw your solution I realized I didn't need to test for the key existence in the hash. I could simply assign to the key. Thanks again.
Edit:
sort keys {
map { $_ => 1 }
grep { ! m{(.).*\1} }
map { join q{}, sort split m{} }
glob $globStr };
I forgot to mention before an optimization I noticed: if there is a repeated digit in the number then there's no need to split and sort it. If you put the grep line after the map, join, sort, split line then it will filter out the repeats before the split(). The split, sort and assign to a hash approach is the exact same one that I took but mine were inside a foreach loop instead of in a map (loop).