package ProneServer; #we received a chat message sub CHAT { my ( $type,$target,$who,$what ) = @_ ; foreach my $p ( @players ) { my $paquet = "SENDTO:"; $paquet .= "CHAT:"; $paquet .= $p->id; $paquet .= ":"; $paquet .= $who ; $paquet .= ":"; $paquet .= $what; print $sock $paquet ."\n"; } return 1; } #register the function $EVENTS->{"CHAT"} = \&CHAT ; return 1;