in reply to backslash and word boundaries while matching

Just wrap it in \Q ... \E:

$output =~ /\b\Q$expectedoutput\E\b/i

If $expectedoutput is constant, add an 'o' modifier for efficiency.

PN5