It really depends on what kind of processing you are doing in the child and whether $filename should be renamed only outside the loop, because that's what you just did when you added that missing curly bracket. Is each child writing to the $filename cumulatively and only when all children are finished writing to it you want to rename it? To me it does not sound right. But I don't know what you are trying to do and your code makes it difficult to guess. And the alarm call, setting the alarm(60) and then canceling it (alarm(0), inside or outside the loop?) makes it even more difficult ... Now that you have the fork semantics working, try and isolate what you want to go inside the alarm in a new function and ask yourself when should files be closed, alarms cancelled and files renamed. Inside or outside the loop it may not matter for Perl, it may not be a syntax error but you may end up blowing up your cpu :) So, step back and think the problem on paper without writing code for a while.
In reply to Re^5: Multiprocess - child process cannot be finished successfully
by bliako
in thread Multiprocess - child process cannot be finished successfully
by wonderG
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |