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);
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.