go ahead... be a heretic | |
PerlMonks |
Re: Perl output on console as well as on text fileby Athanasius (Archbishop) |
on Jan 05, 2015 at 07:03 UTC ( [id://1112152]=note: print w/replies, xml ) | Need Help?? |
Hello shyamasoni, If you don’t need the text file to be written out until the script has completed, you can use either the tee_stdout or the tee_merged function from Capture::Tiny. Here is some proof-of-concept code:
Console output:
Text file output:
Note that tee_merged captures output to STDOUT and STDERR, but not input from STDIN (i.e. via the keyboard). Hope that helps,
In Section
Seekers of Perl Wisdom
|
|