Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: confusing fork/readline behaviour

by KurtSchwind (Chaplain)
on Aug 13, 2015 at 18:19 UTC ( [id://1138475]=note: print w/replies, xml ) Need Help??


in reply to confusing fork/readline behaviour

<quote>as they don't share a file pointer </quote>

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" '
--
“For the Present is the point at which time touches eternity.” - CS Lewis

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1138475]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-26 04:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found