in reply to Pattern matching

Do not confuse pattern matching with logical (boolean) constructs.

If you want to match this pattern (and only this one) tom and (dick or harry or john), the regex to use is
m/^tom and (dick or harry or john)$/.

If you want to match a pattern which consists of an arbitrary string containing "tom" and (one or more of) "dick", "harry" or "john", with "tom" coming earlier in the string than "dick", "harry" or "john", you could think of using
m/\b(tom)\b(.*?)\b(dick|harry|john)\b/

The matter becomes all of a sudden much more difficult if the "or" is to be understood as "xor". This however is left as an excercise for the readers.

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law