in reply to Re: value uninitilized when using Parallel::ForkManager module
in thread value uninitilized when using Parallel::ForkManager module

It seems to me that this code line: $pwm_count_hash->{$pwm}) = count_pwm_num($pwm,$seq_1,$seq_2); is never executed, because of the next instruction of the previous line (unless $pm->start fails).

This is how Parallel::ForkManager works: $pm->start hides a fork() call and returns true (the child's PID) in the parent process and false in the child process. $pm->start and next makes sure that all following code is executed only in the child process, $pm->finish() at the end of the loop hides exit() and makes sure that the loop is executed only once in the child process. (Actually, Parallel::ForkManager does a little bit more. See the documentation.)

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^3: value uninitilized when using Parallel::ForkManager module
by Laurent_R (Canon) on Apr 14, 2015 at 17:45 UTC
    Thank you very much for the information, afoken, I did not know, because I never used Parallel::ForkManager, but I should probably have guessed something like that, since I wrote forking programs, albeit quite sometime ago and not in Perl.

    Je suis Charlie.