in reply to Re: Re: Help: STDOUT flaking out?
in thread Help: STDOUT flaking out?

This works now: Thank you :)
# send output to file @args2 = ("$tabfile"); open (LOGFILE, ">$logfile") || die "could not open log\n"; unless (system(@args2) == 0) { print STDERR "system(@args2) failed: $? $!\n"; return; } select(LOGFILE); close(LOGFILE);

Replies are listed 'Best First'.
How do I reset STDOUT?
by P0w3rK!d (Pilgrim) on May 17, 2001 at 20:07 UTC
    In reference to the previous postings: After I cat the log file I create, it shows that not only the 1st line which was grabbed from the $tabfile output, but also the output from:
    print "foo1\n";
    and
    print "GOT THIS: $lines\n";
    RESULT: $ ftp_flow.pl logfile = /tmp/ftp_flow.12547410117.log errfile = /tmp/ftp_flow.12547410117.err $ cat /tmp/ftp_flow.12547410117.log FTPData.20010517.120547 foo1 GOT THIS: FTPData.20010517.120547 $
    How do I set STDOUT back to normal?
    # send output to file @args2 = ("$tabfile"); open (STDOUT, ">$logfile") || die "could not open log\n"; unless (system(@args2) == 0) { print STDERR "system(@args2) failed: $? $!\n"; return; } select(STDOUT); close(STDOUT); print "foo1\n"; # read the file to obtain the file tabdata created local(*LOGFILE); open (LOGFILE, $logfile) || die "Couldn't open: $!"; $lines=<LOGFILE>; #get line 1 from the file close(LOGFILE); print "GOT THIS: $lines\n"; exit(0);