if($name eq $match) { print "Second found match: $name\n"; print "Second sending \"$name\" to Third\n"; print $t_socket "$name\n"; while(<$t_socket>) { #print "Second has accepted socket to Third...\n"; my $name = $_; chomp($name); my $t_host = gethostbyaddr($t_socket->peeraddr, AF_INET); my $t_port = $t_socket->peerport; print "Received from [$f_host $f_port]: $name\n"; } }