The problem is that with system("perl 2.pl"); you call a new instance of perl, which has no shared memory with the one that calls it. Those are two different processes.
What you probably want to do is do "2.pl", this way 2.pl will be run in the same context as 1.pl . Look do's documentation for information on that.
In reply to Re: Sharing a variable across multiple files
by Eily
in thread Sharing a variable across multiple files
by bihuboliya
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |