# This is ls.pl use strict; use warnings; use IPC::Open2; # OUTPUT: Filehandle for output from cat.pl # INPUT: Filehandle for input to cat.pl open2(*OUTPUT,*INPUT,"$^X", "cat.pl") or die "$!"; print INPUT "first line\nsecond line\n"; if ($^O eq 'MSWin32') { select INPUT; $| = 1; print INPUT chr(0x1a); } close INPUT; my @result=; close OUTPUT; print "RESULT:\n@result\n";