in reply to writing to a named pipe

You can get a summary of the properties of named pipes from 'man 4 fifo'. If all readers go away and close the other end of the fifo, a SIGPIPE is raised to the writer which tried. You can set up a global variable which is set by $SIG{PIPE} and tested after each write.

use vars '$no_reader'; $no_reader = 0; $SIG{PIPE} = sub { $no_reader = 1 }; # ...

You can do a non-blocking open with sysopen. See also Fcntl and perlopentut.

After Compline,
Zaxo