![]() |
|
Welcome to the Monastery | |
PerlMonks |
Re^2: regex, find words that occur more than once.by GrandFather (Saint) |
on Sep 15, 2020 at 00:15 UTC ( #11121777=note: print w/replies, xml ) | Need Help?? |
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
In Section
Seekers of Perl Wisdom
|
|