in reply to scoping across parent/child relationship
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: scoping across parent/child relationship
by geektron (Curate) on Aug 30, 2001 at 21:29 UTC |