fork download
  1. # a.pl
  2. use IO::Handle;
  3. open( my $fh_b,'| ./b.pl') || die( $!);
  4. open( my $fh_c,'| ./c.pl') || die( $!);
  5. $_->autoflush( 1) foreach $fh_b,$fh_c;
  6. print( $fh_b "\n");
  7. sleep( 2);
  8. print( $fh_c "\n");
  9. sleep( 2);
  10. print( $fh_b "\n");
  11.  
  12. # b.pl
  13. <>;
  14. printf( STDERR "%s:%u:%u\n",$0,__LINE__,time);
  15. open( my $fh,'>','a.txt') || die( $!);
  16. print( $fh "pid=$$\n");
  17. printf( STDERR "%s:%u:%u\n",$0,__LINE__,time);
  18. <>;
  19. printf( STDERR "%s:%u:%u\n",$0,__LINE__,time);
  20. close( $fh);
  21.  
  22. # c.pl
  23. <>;
  24. printf( STDERR "%s:%u:%u\n",$0,__LINE__,time);
  25. rename('a.txt','b.txt') || die( $!);
  26. printf( STDERR "%s:%u:%u\n",$0,__LINE__,time);
  27.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty