How can I, prior to having $pid set in the fork, make the block that loads @hosts execute only in the parent?
Of course you know that prior to the fork the children do not exist, and that none of the work that was done before the fork takes place is redone by the children. At child process begins life with an exact duplicate of the state of the parent. So the @hosts array was loaded by the parent and only by the parent.
In reply to Re: Forkin around
by tall_man
in thread Forkin around
by gnu@perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |