Perhaps you should look into IO::Tee since you are trying to write to two different filehandles at once.
The following is to be considered psuedocode since I don't have your full source code:
use IO::Tee; my $tee = IO::Tee->new("|$externalprogram",">>$log"); print $tee <<EOJ; (lines to send to external program) EOJ
Note: you may have to use it in conjunction with IO::File.
In reply to Re: Feeding data to external program
by Mr. Muskrat
in thread Feeding data to external program
by nimdokk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |