use Fcntl; my $flags; fcntl(FILEHANDLE, F_GETFL, $flags) || die $!; # Get the current flags on the filehandle $flags |= O_NONBLOCK; # Add non-blocking to the flags fcntl(FILEHANDLE, F_SETFL, $flags) || die $!; # Set the flags on the filehandle