http://qs1969.pair.com?node_id=1073995

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

I am trying to have a named pipe with only one line at time. As this named pipe will be read by another program may be a C/C++ program I can't delete before doing that operation.

Below is a sample code which I am trying to put.

use strict; use warnings; use POSIX qw(mkfifo); my $path = "./test_fifo"; unless ( -p $path) { mkfifo($path, 0666) or die "can't mknod fpath: $!"; warn "$0: created $path as a named pipe\n"; } while (1) { open(FIFO, "+> $path") or die "Couldn't open $path for writing: $!\n"; #truncate(FIFO, 0) or die "Can't reduce size to 0 $!\n"; print FIFO "The current time is ", scalar(localtime), "\n"; close FIFO; sleep(1); }

Any thoughts how to do it.