while (<$first>) { my $name = $_; chomp($name); #send acknowledgement message to First print "Received from [$f_host $f_port]: $name\n"; #print $f_socket "$.: $name\n"; #Sending info upstream to Third process #this part works fine if($name eq $match) { print "Second found match: $name\n"; print "Second sending \"$name\" to Third\n"; print $t_socket "$match\n"; } #after I send I am expecting a response #from Third process #I never get into this loop #it skips or accept() blocks indefinitely while(my $third = $t_socket->accept) { print "Second has accepted socket to Third...\n"; my $t_host = gethostbyaddr($third->peeraddr, AF_INET); my $t_port = $third->peerport; while (<$third>) { my $name = $_; chomp($name); print "Received from [$f_host $f_port]: $name\n"; if($name eq $match) { print "Received \"$name\" from Third\n"; last; } else { last; } } } }