use IPC::Open2; open IN, "<", "commandfile"; # unfortunately, scalar filehandles won't work this way open OUT, ">", "logfile"; my $pid = open2(">&OUT", "<&IN", "theprogram"); waitpid $pid, 0;