Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: confusing fork/readline behaviour

by KurtSchwind (Chaplain)
on Aug 13, 2015 at 18:19 UTC ( #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
Node Status?
node history
Node Type: note [id://1138475]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2020-02-19 10:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?










    Results (81 votes). Check out past polls.

    Notices?