try this source and wonder why perl hangs or reports bad file number!
any help is appreciated.
TIA
[log in to unmask]


#!/usr/local/bin/perl
#
$fname="Pipe";

unless (-p $fname) {
  unlink $fname;
  system('mkfifo', $fname) &&
    system('mknod', $fname, 'p') &&
    die "can't create $fname: $!!\n";
  }

# uncomment one of the open commands to see the difference

# open( PIPE1, "+>$fname") || die "Could not open the named pipe -
$!!\n";
# will print error:
# Could not open the named pipe - Bad file number!

# open( PIPE2, ">$fname") || die "Could not open the named pipe -
$!!\n";
# program hangs