my $sock = new IO::Socket::INET ( ... ) my $ns = $sock->accept() ; { local *STDOUT ; open STDOUT, '>', $ns or die "Nope: $!\n"; print "thnx for usign me\n\n" ; # send message to client #print $ns "thnx for usign me\n\n" ; # this works } close($sock);