Because after the fork there's two different processes with two different copies of $a. The child modifies its $a, but the parent's copy is unmodified. You'd either need to use threads (which have their own headaches) or something like IPC::Shareable to make a single variable visible in multiple execution contexts.
In reply to Re: Keeping variables throug a fork
by Fletch
in thread Keeping variables throug a fork
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |