usrlocal has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I havent had the chance to research this much and it probably is a very simple one to answer. We have a log file to which we write Errors from different tasks to via a named pipe. In a shell script its as simple as saying: openpipe xxx.fifo
echo "ERROR : ..." >> xxx.fifo
How would I accomplish the same in perl. I do know of the print statememnt part. trying to figure out how to do the redirection. thanks for the help.

Replies are listed 'Best First'.
Re: writing to a file via a named pipe
by tilly (Archbishop) on Jan 26, 2009 at 22:28 UTC
    open(PIPE, ">> xxx.fifo") or die "Can't append to 'xxx.fifo': $!"; # time passes print PIPE "ERROR : ...\n";
Re: writing to a file via a named pipe
by moritz (Cardinal) on Jan 26, 2009 at 22:37 UTC
    If you have more questions like this, I highly recommend perlopentut.
      supposing i want to write to a pre-existing pipe, how do i do that. the perlopentut dosent seem to be clear on that. thanks
        If the pipe is a named pipe, you can just open it like any other file (except that seeking will not work, I guess).