Actually for reading they do share the same file descriptor. Try moving that open after the fork().
perl -e ' fork(); open X, "</etc/passwd"; while (readline(X)){ print "$$: $_"; sleep 1 } print "$$: all done\n" '
In reply to Re: confusing fork/readline behaviour
by KurtSchwind
in thread confusing fork/readline behaviour
by flipper
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |