On 8/29/11 Mon Aug 29, 2011 7:53 AM, "Ramprasad Prasad" <ramprasad...@gmail.com> scribbled:
> How can I open multiple FIFO files in perl and print to them simultaneously The program below only opens one FIFO. Is your problem related to opening multiple FIFOs or opening one FIFO? > I tried a simple script does not work "Does not work" is not a helpful description of the problem. It would help if you could tell us exactly what happens when you run your program. Cut and paste the actual error messages, if any, that you are getting into your post. > > > #!/usr/bin/perl > use strict; > > use IO::File; > $|=1; > system("rm -f /tmp/fifo1;mkfifo /tmp/fifo1"); > open (OUT,"> /tmp/fifo1") || die; > for (0 .. 10){ > print "Hi $_\n"; > print OUT "Hi $_\n"; > > } > close OUT; This program creates, opens, and writes to a FIFO. This program should block on writing to the FIFO until there is a corresponding reading process that reads from the FIFO. Is there another program reading the FIFO? See 'perldoc perlipc' and search for "Named Pipes". You will learn there that there is no need to create a new process to create the FIFO, as you can use the POSIX module and its mkfifo function. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/