Tony Esposito wrote:

From: John W. Krahn <jwkr...@shaw.ca>

Shawn H. Corey wrote:
John W. Krahn wrote:
Shawn H. Corey wrote:
Wagner, David --- Senior Programmer Analyst --- CFS wrote:
    I am done processing and I want to place the final output
line also on the screen. Here is what I have:

    if ( $GlblInfo{audit} ) {
        printf "\n\n*****Should be last line in the audittrail
file...*****\n\n";
        close(STDOUT);
        close(STDERR);
        open(STDOUT , '>') || die "Unable to open STDOUT: $!";
You're not opening STDOUT to anything.  And you closed STDERR so
the die message can't go anywhere.  In fact, it goes into an
infinite loop.
No it doesn't, there is no loop there.
It goes into an infinite loop on my machine.  I suggest you try it
before you make such blanket statements.

I did and it doesn't on my machine.  Perhaps your OS or C library is
doing something stupid?  It makes no sense for IO on an unopened
filehandle to loop.

Back to the question at hand - have you tried using 'tee'

use File::Tee qw(tee);

# simple usage:
tee(STDOUT, '>', 'stdout.txt');

Why would I want to?



John
--
Those people who think they know everything are a great
annoyance to those of us who do.        -- Isaac Asimov

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to