else { # store message in queue push( @clients , $text[1] ); #--> --^ # further down ... print Dumper(\@clients); $trans = "OK"; $client_data = &send($trans); print "Second send: ".$client_data."\n"; } } # End of if ($text[0] eq "NICK") elsif ($text[0] eq "MSG") { if (length($text[1]) > MAXBYTES) { $trans = "".$error." Please remember that message limit is ".MAXBYTES.""; $client_data = &send($trans); print "In case of message over ".MAXBYTES." send: ".$client_data."\n"; } else { print "Second receive: ".$text[1]."\n"; print "This is \$sock: ".$sock."\n"; # Get all client(s) socket(s) my @sockets = $readable_handles->can_write(); #my $count = $readable_handles->count(); # store messages in hash ? # for as many sockets that are readable, take the message # with the index of this this number, from the message # queue and replace the current hashed socket queue with # it. # that is, if 5 clients then each client will continue to # recieve the fifth messages from the message queue. # or at least teh log will only record that, depending on # whr STDOUT for ($_ = 0; $_ < @sockets; $_++) { $hash{$sock} = $clients[$_]; } # or $hash{$sock} = $clients[ scalar @{$select_object->can_write()} ]