for(;;){ sleep(1); $SendMessage->Call($readchat,0x00B1,0,$u); #select all chat $clipb->Empty(); #empty clipboard $SendMessage->Call($readchat,0x0301,0,0); #copy chat to clipboard $thechat = $clipb->Get(); #obtain chat from blipboard next if $thechat !~ /\(\w{5}\)>\s(\w+)/; #Match stuff of format # "(Enter)> Some_Name" and #stores Some_Name in $1. next if $people{$1}; #next unless he is *new* $msg = "Hi $1 and welcome to my Room!"; #compose a hello message $people{$1} = 1; #Note he has entered } # --- Message is sent here --- }