Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I was wanting something like this, so it was good to find. So how has 12 years changed things other than it still works? Tech note D is of interest: Creating the word signature with pack "C*", sort unpack "C*", $_ is faster than using join "", sort split //, $_;With Perl 5.14.2, the join/sort/split version is actually faster now, only by a few hundredths of a second on my machine, but it is faster. This is on 917K words. It also generates a correct signature, while the pack version generates a bad signature. Changing the last line to foreach(sort(keys(%words))) { print "$_- $words{$_}\n"; } allows us to compare:
I found the key generation error because I actually want the key to be available and need the letters to be in alphabetical order for another program. Thanks for sharing! In reply to Re: Perl's pearls
by kbrannen
|
|