use strict; use IO::Socket; my $socket=IO::Socket::INET->new(LocalAddr => 'localhost', LocalPort => 9000, Proto => 'udp') or die "socket: $!"; my $length; while (defined($length=sysread($socket, my $buffer, 65536)) && $length != 0) { die "sysread: $!" if (!defined($length)); # When I have a connect from a client start another very big script :) system('./sleep.pl'); exit; }