#!/opt/perl/bin/perl -w use strict; use IO::Handle; use IPC::Open3; # Does not work with >= 8192 my $cmd = "echo ".("x" x 8191); my($reader, $writer, $error) = ( new IO::Handle, new IO::Handle, new IO::Handle ) or die "couldn't :$!"; $reader->autoflush(1); $writer->autoflush(1); $error->autoflush(1); my $pid = open3($writer, $reader, $error, $cmd) or die "couldnt: $!"; print "PID: $pid\n"; waitpid $pid, 0; print "OK\n";