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