I suspect your error is not related to the forking in any way. From your question I'm guessing that your subs look sth like this
but they are declared outside somewhere else in your program. But this code doesn't work. Let's simplifysub Initialize_child { print $foo; }
This code works, because the declaration of the sub is in the same scope as the my. Now let's change this:use strict; my $foo = 1; bar(); sub bar { print $foo; }
This doesn't work any longer because variables declared with my are not visible in subroutines called from the same scope unless the subroutine is declared in this scope as well (see example above).use strict; { my $foo = 1; bar(); } sub bar { print $foo; }
If this isn't your problem, post some more code.
-- Hofmator
In reply to Re: scoping across parent/child relationship
by Hofmator
in thread scoping across parent/child relationship
by geektron
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |