Been awhile since I even looked at this stuff

Not sure, but seems that should work, but like I said been a long time since I even looked at this.
And the perl quests weren't my favorite anyways

Hope it works/helps. (I have no way to test it)
sub EVENT_SAY{
if($text=~/hail/i) && ($class == 'Warrior' || $class == 'Monk' || $class == 'Rogue' || $class == 'Berserker')
{
quest::say("You are a $class . You cannot cast spells.");
}
}