Marcello has asked for the wisdom of the Perl Monks concerning the following question:
After the fork, the child process creates several objects, one of which gets gets a reference to this hash. This process then calls an object function which alters the $_ variable. The reference to the hash is never changed nor used.foreach (@{ $HASH{"IP"} }) { # Please note $_ is used here # IP contains two IP addresses ... forking goes here ... }
the IP array in the hash is not altered anymore. So it appears the $_ variable has something to do with it, but I do not see where this goes wrong. Especially because the IP array is not altered anywhere in the application and the $_ is changed in another package. I suspect it's a problem with the forking, the reference to the hash and the $_ variable.foreach my $notUsed (@{ $HASH{"IP"} }) { # Please note $_ is NOT used here # IP contains two IP addresses ... forking goes here ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reference and $_ weirdness
by Joost (Canon) on Jun 27, 2005 at 09:34 UTC | |
by Marcello (Hermit) on Jun 27, 2005 at 09:53 UTC |