in reply to Mail script is cutting out data.

well, you're using so few Perl things in that script that it's not really a Perl-related problem.

But you're lucky: It _is_ a Perl problem :-) You didn't close the file, so the output "might have not been flushed" and that's the case: the last print() has not been flushed, so your file doesn't contain the contents yet.

2 ways to solve the problem: 1. say "$|=1" at the beginning of your script and read perlvar to understand it 2. (=recommended) close your file before the system("cat ...").

Replies are listed 'Best First'.
Re^2: Mail script is cutting out data.
by Aristotle (Chancellor) on Jul 08, 2002 at 17:12 UTC

    $|=1 only sets autoflush on the currently selected filehandle, which is STDOUT, and won't solve the issue for the FIL handle.

    Instead, he wants to
    open(FIL,">>$myfil") || "Can't open $myfil: $! \n"; select((select(FIL), $|=1)[0]);
    or alternatively, and much easier on the eyes,
    use IO::Handle; open(FIL,">>$myfil") || "Can't open $myfil: $! \n"; FIL->autoflush();
    ____________
    Makeshifts last the longest.
Re: Re: Mail script is cutting out data.
by Anonymous Monk on Jul 08, 2002 at 17:08 UTC
    Thank you for quick responses. I looked at this for hours and you all solved it fast. Thanks for another lesson in Perl that I needed.