$what = "[box]"; foreach (qw(in[box] out[box] white[sox])) { if (/\Q$what\E/) { print "$_ matched!\n"; } }