if ( q{abcdefgh} =~ /(?:$a|$b|$c)/ ) { # Do something }