@a = ('hello(\w+)', ...); #### $a = "Hello(world)"; $b = shift(@a); if ($a =~ /$b/o) { print "Matched!\n"; } #### @a = ('hello\((\w+)\)', ...);