if($msg =~ /so?r?ry/) { # Increase and save the count. writecount($filename, ++$count); }