my $input; sysread( \*STDIN, $input, 1024); #### use Fcntl; fcntl(\*STDIN, F_SETFL, O_NONBLOCK) || die "$!\n"; # Set the non-block flags