if ($strMessage =~ m/^\Q$prefix\Eregex (.*?) @ (.*?)\r\n/) { if ($2 =~ m/$1/) { print $sckSocket 'PRIVMSG ' . $strChannel . ' :Your regex is correct' . "\r\n"; } else { print $sckSocket 'PRIVMSG ' . $strChannel . ' :Your regex fails' . "\r\n"; } }