Hi, I am still learning Perl but I'm working on my first project which is a Perl chat script. All has been going well but I'm stuck on how to make one of my features work. This chat script logs public messages by default but I have given the admin the option to choose if they want private messages to be logged or not.
Ok so I'm stuck on how to write this out and make it work.
The chat has a config file where this option can be enabled by setting the variable to 1. The variable for turning this on is:
$pm_log = 1; So...in my script, so far I've gotten
if($pm_log) {
&logfile("(PRIVATE-MSG)")
}
elsif ($pm_type eq "private") {
&logfile("(PRIVATE) [$pm_from -to- $pm_to] $pm_message
+", 3);
for IF $pm_log is on, then do this..... and that is where I'm stuck. What code should be run for this if conditional? Can someone please help...I'm having a moment and I'm just stuck here. If I'm not mistaken...doesn't this mean IF pm_log is true, log private messages elsif still log private messages? I want this to be an optional feature that the admin of the chat can choose. Thanks!