You should also escape interpolated stuff in regexen. \Q${wordstem}\E in this case. If you don’t, you can end up with really confusing bugs and, depending on Perl version, a malicious regex that can be a DoS attack. I would encourage you to use /x to improve readability. Something like–
/ \b \Q${stem}\E (?: s | 's | n )? \b /xi
In reply to Re^3: Regex: match a word stem plus an optional suffix from a group
by Your Mother
in thread Regex: match a word stem plus an optional suffix from a group
by element22
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |