Usiing CON as the filename will only get the output to the command line. To capture it into the program you should use open instead. Something like
open IN, "echo $script | $program |" or die $!;
binmode IN;
my $img = do{ local $/; <IN> };
close IN;
See perlopentut for the details of grabing program output using open. This is necessary as you will need to use binmode to prevent the stream being interupted by ^Z.
Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
|