#!/usr/bin/perl -w #test1.pl use IPC::Open2; use IO::Handle; use strict; my $output = ''; my $program = 'test2.pl'; my ($infh,$outfh) = (IO::Handle->new, IO::Handle->new); open2($infh, $outfh, ($program)); print $outfh "The rain in Spain stays mainly on the plain.\n"; while (<$infh>) { $output .= $_; } close($outfh); close($infh); print $output; exit;