write to stdout and another file at the same time.

A

akbari_n

All,

I am writing a perl script that does do a bunch of admin stuff.
What I need help with is this (I have done it in the past, I just can
not remember it now !)

I need to capture everything that this script does.

For example if it prints something to the screen, I need that to be
dumped into a file at the same time. So we are writing in 2 places.
1) To the screen 2) A file that acts as our log file.

Please keep in mind that I need to do this from inside the perl script.
I do not intend to do it this way " myScript.pl > log& ". A long time
ago I did that and put one line after the magic line and it took care
of it for me, it had something to do with |tee.
I just can not remember it and I can not figure it out.


Any help is greatly appreciated.

Thanks in advance,

p-
 
J

John W. Krahn

I am writing a perl script that does do a bunch of admin stuff.
What I need help with is this (I have done it in the past, I just can
not remember it now !)

I need to capture everything that this script does.

For example if it prints something to the screen, I need that to be
dumped into a file at the same time. So we are writing in 2 places.
1) To the screen 2) A file that acts as our log file.

Please keep in mind that I need to do this from inside the perl script.
I do not intend to do it this way " myScript.pl > log& ". A long time
ago I did that and put one line after the magic line and it took care
of it for me, it had something to do with |tee.
I just can not remember it and I can not figure it out.

Any help is greatly appreciated.

perldoc -q "How do I print to more than one file at once"



John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,266
Messages
2,571,083
Members
48,773
Latest member
Kaybee

Latest Threads

Top