in reply to Single string pattern match

 if ($str =~ /((abc)|(pqr)|(xyz))/) $1 would contain first pattern that matches. (update: added external () to make $1 work)