in reply to Advice on make my programme faster

Well, if similarity gets called often with the same arguments then Memoize could help, caching values to prevent recalculation...

Another thing to look into is Devel::SmallProf which shows you how many times a line is run and how long your program spends running it, to help you find slowdowns.

You may also find a speedup if you can manage to create $Measure->new($wn) only once instead of at each call, but I'm not sure if the module will allow that, not being familiar with it.

                - Ant
                - Some of my best work - (1 2 3)