Prev: FAQ 3.14 How can I write a GUI (X, Tk, Gtk, etc.) in Perl?
Next: FAQ 1.13 Is it a Perl program or a Perl script?
From: John Kelly on 28 Jun 2010 18:50
On Mon, 28 Jun 2010 23:39:59 +0100, Big and Blue <No_4(a)dsl.pipex.com>
>> John Kelly<jak(a)isp2dial.com> writes:
>>> This code reads STDIN and remembers the first non-empty line. That's
>>> all it cares about.
>>> But it also keeps reading till EOF, acting like the "cat" utility, to
>>> flush the extra input and avoid broken pipe errors.
>>> But reading line by line, just to throw away the unwanted garbage, is
>>> inefficient. I would like to jump out of the loop and "bulk flush" the
>>> remaining input stream.
>exec a fork() of cat >/dev/null?
I sometimes use that idea in shell scripts, though at the cost of an
But I'm not sure if it would be more efficient than a perl loop with a
fixed buffer size.
Web mail, POP3, and SMTP