in reply to Recording input and output of a command in file
Why so complicated? Why not simply print to STDOUT and directly after that to your file? And after each input, print that input to the file too?
You could write a sub my_print that does the double printing, so instead of:
print "Directory to install to: "; print $log "Directory to install to: ";
you would write
my_print("Directory to install to: ");
and my_print would then be something like:
sub my_print { my($txt)= @_; print $txt; return unless $log; print $log $txt; }
|
|---|