in reply to Global variable acts like local variable why?

AFAIK, once you have forked, the child is a copy of the parent and is independant of it. In other words, if you change a variable in the parent it will have no effect on the varaible of the same name in the child. They are separate processes.

Cheers,

JohnGG