http://www.perlmonks.org?node_id=850542


in reply to Wrap around an interactive python script

You can do this through open pipe, but you might run into some buffering problems.

open(LOG,">>/path/to/log"); open(SYS,"/path/to/python/script.py |"); while (<SYS>) { print $_; print LOG $_; } close(SYS); close(LOG);

This way you can print to screen and to your log file