The parentheses are just as necessary without the {} construct. If $what is 'fred|barney', you want to
match /(fred|barney)(fred|barney)(fred|barney)/, not /fred|barneyfred|barneyfred|barney/.
I see from fred that fred and barney are fully paid up members of the metasyntactic variable club :)