in reply to suffix arrays

I'm a little confused about what you are asking for. You want to search a set of strings and try to find common suffixes? Your implementation doesn't seem to do that.

Your implementation also isn't very efficiently written. Your sort of @arr, for instance, could benefit from a Schwartzian Transform.

Looking into my crystal ball... I have a feeling hashes will play a part in your answer.

Update: (After some research at ddj.com...) Oh, I see. You are talking about doing substring searches using suffix trees... Frankly, I'm not sure why you would bother to do that in Perl where index() and rindex() essentially do it for you. :-)

Update: To be fair, there are some nifty things you can do with suffix trees that aren't as easy as using index(). That doesn't necessarily mean that using suffix trees is the best way to do them in Perl though. Do you have a specific application in mind or were you just hoping to play with suffix trees in Perl?

-sauoq
"My two cents aren't worth a dime.";