razmeth has asked for the wisdom of the Perl Monks concerning the following question:
I'm using Windows for this scripting, and I'd like to perform something which seems to be less simple than I'd expect.
I want to use a standard print command, and have the ouput printed to the screen as well as to a file. I do not need to modify STDERR, though that would be an added benefit, and I don't want to print to a specific function which then prints to multiple locations. Is this simpler than my time spent searching has implied?
Desired code:
<Some way to split the output>
print "Hello World!"
Desired output on screen:
Hello World!
Desired output in text file:
Hello World!
I want to use a standard print command, and have the ouput printed to the screen as well as to a file. I do not need to modify STDERR, though that would be an added benefit, and I don't want to print to a specific function which then prints to multiple locations. Is this simpler than my time spent searching has implied?
Desired code:
<Some way to split the output>
print "Hello World!"
Desired output on screen:
Hello World!
Desired output in text file:
Hello World!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Split output to STDOUT as well as a file
by BrowserUk (Patriarch) on Jan 05, 2016 at 05:03 UTC | |
by razmeth (Acolyte) on Jan 06, 2016 at 13:43 UTC | |
Re: Split output to STDOUT as well as a file
by Athanasius (Archbishop) on Jan 05, 2016 at 06:34 UTC | |
Re: Split output to STDOUT as well as a file -- multiplexing
by Discipulus (Canon) on Jan 05, 2016 at 18:03 UTC |
Back to
Seekers of Perl Wisdom