in reply to Feeding values to an existing program
open(PROG,"|program > logfile")
while $data = <DATASOURCE>{
print PROG $data;
}
This will open "program" and redirect its output to "logfile", leaving you with a pipe ti its stdin. You can write to this pipe through the filehandle "PROG"
The drawback of this approach is that it is not very sophisticated (does your program 'prompt' when it wants input, or does it constantly accept it, expect would help if the former is the case), but the value is that it is simple.
|
|---|