Perl Monk, Perl Meditation | |
PerlMonks |
Re: This turned out not to be the disaster I expectedby ambrus (Abbot) |
on Jun 10, 2007 at 00:23 UTC ( [id://620229]=note: print w/replies, xml ) | Need Help?? |
Update: Ok, let me think this over again after reading the other replies. Firstly, I realized that fork wouldn't cause a fork bomb as I thought for some reason, only fork exactly once. Now I didn't realize getc would do something significant (as opposed to, say, warn which just prints some output) until I've read FunnyMonk's reply. So this means that if we get over dump and exit, the script would fork exactly once and then try to read the terminal from both processes. This is not the typical job control situation, because the two interpreters are in the same process group, so I have to look it up in the manual what happens exactly. *looks it up* I can't find it out from the manual. Let me try. *tries* Apparently nothing special happens, they read lines after each other in some random order. Secondly, I realized that I thought of redo but not last or next. last would obviously exit the loop and thus end the program. next would also cause an infinite loop the same way as redo, but this could be avoided by putting the $s++ in a continue block. Of course, none of these change my answer being dump.
In Section
Meditations
|
|