write to stdout and another file at the same time.

Discussion in 'Perl Misc' started by akbari_n@yahoo.com, Jun 4, 2005.

  1. Guest

    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-
     
    , Jun 4, 2005
    #1
    1. Advertising

  2. wrote:
    >
    > 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
    --
    use Perl;
    program
    fulfillment
     
    John W. Krahn, Jun 4, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. gabor
    Replies:
    19
    Views:
    1,161
    Steve Holden
    May 31, 2005
  2. Jp Calderone
    Replies:
    7
    Views:
    1,234
    Mike Meyer
    May 28, 2005
  3. Jp Calderone
    Replies:
    0
    Views:
    473
    Jp Calderone
    May 27, 2005
  4. Jp Calderone
    Replies:
    4
    Views:
    467
    gabor
    May 31, 2005
  5. Replies:
    1
    Views:
    394
    Victor Bazarov
    Feb 13, 2008
Loading...

Share This Page