use strict;
use warnings;
use IO::Handle;
$^F = 100;
pipe READHANDLE,WRITEHANDLE;
binmode READHANDLE;
binmode WRITEHANDLE;
WRITEHANDLE->autoflush;
READHANDLE->autoflush;
unless (fork()){
exec $^X, $ARGV[0], fileno(READHANDLE);
die;
}
print WRITEHANDLE "Test!\n";
close WRITEHANDLE;
wait;
####
open IN, "<&", $ARGV[0] or die $!;
binmode IN;
while(defined($_ = )) {
print "line $_";
}
close IN;
##
##
open IN, "<&", $ARGV[0] or die $!;
binmode IN;
my $s = ;
print "line: $s";
close IN;
##
##
perl main.pl subcommand1.pl
##
##
perl main.pl subcommand2.pl
##
##
cat subcommand1.pl | perl subcommand1.pl 0