madtoperl has asked for the wisdom of the Perl Monks concerning the following question:
Regards,$extflag=0; print"Flag outside loop=> $extflag\n"; if(defined($pid = fork)) { if ( $pid ) { print"PARENT PROCESS\n"; $extflag=1; print"Flag inside paretn=> $extflag\n"; waitpid ($pid,0); } else { print"CHILD PROCESS\n"; sleep 10; while(!$extflag){ print"Flag inside while child > $extflag\n"; } print"Flag outide while in cheild=> $extflag\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Global variable acts like local variable why?
by kyle (Abbot) on Mar 06, 2007 at 14:48 UTC | |
|
Re: Global variable acts like local variable why?
by davorg (Chancellor) on Mar 06, 2007 at 14:49 UTC | |
|
Re: Global variable acts like local variable why?
by johngg (Canon) on Mar 06, 2007 at 14:50 UTC | |
|
Re: Global variable acts like local variable why?
by Moron (Curate) on Mar 06, 2007 at 15:39 UTC |