http://qs321.pair.com?node_id=11121777


in reply to Re: regex, find words that occur more than once.
in thread regex, find words that occur more than once.

Nice synthesis of the advice you got!

In production code dealing with many searches on large strings you might want to make the .* match in the look ahead assertion non-greedy (.*?) so a search to the end of the string isn't required. Also, adding sort to (keys %words) gets the words in consistent order making it easier to find particular results if there are a lot of words.

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond