in reply to what is EOF and how can I send it?

EOF is when you ask to read some byte(s) and you don't get an error but you get zero bytes read.

Interactively, CTRL-D flushes your input. If you've just flushed your input already (by pressing RETURN which queued up a newline then flushed the input), then flushing again with CTRL-D means that 0 bytes get flushed to the next read request (and so gets interpretted as EOF).

Most other forms of I/O don't support this abillity to flush all the way through to the reader without irreversibly closing the handle.

In other words, you're out of luck... unless you want to use a pseudo-tty...

- tye        

  • Comment on Re: what is EOF and how can I send it? (0 bytes read)

Replies are listed 'Best First'.
Re^2: what is EOF and how can I send it? (0 bytes read)
by Anonymous Monk on Jun 14, 2012 at 22:18 UTC
    Ok well I just ran into this post, and I think that the conversation got muddled... the Key is if you're doing a bidirectional pipe to close the Writer stream... Sorry about updating an old post, but its first Google response.
    sub pushusers() { my $host = shift; my $cmd = sprintf("ssh %s@%s perl",$user,$host); my $pid = open2(*Reader, *Writer, $cmd); print Writer "die('got into perl')\n"; close(Writer); my $output = <Reader>; print "Got from host ${host} output: ${output}"; exit(0); }
    -Anacreo