if ($string =~ /($regexp)/) { if ($1 eq "insert" or $1 eq "delete" or $1 eq "update") { do something with $string } call a subroutine here... }