note
gmax
Your script is very elegant, shorter and functionally equivalent.<br>
However, this simplicity comes at a price. The overhead of a second hash to eliminate duplicates is a heavy load on performance, especially after adding "use strict" and "-w" on top.<br>
I compared the execution times on a 102_759 words dictionary.<br>
<CODE>
$ time perl gmax_anagram.pl < words |wc
4.26user 0.07system 0:04.32elapsed
6427 14802 107910
$ time perl merlyn_anagram.pl < words |wc
6.35user 0.10system 0:06.45elapsed
6427 14802 107910
(after adding use strict and -w)
$ time perl merlyn_anagram.pl < words |wc
7.44user 0.12system 0:07.55elapsed
6427 14802 107910
</CODE>
Anyway, this approach is one more thing to know, if I want to privilege a shorter script in favor of a faster one.<br>
Thanks.<br>
<pre>
_ _ _ _
(_|| | |(_|><
_|
</pre>
135345
135391