G'day bihuboliya,
"The changes made to the variable @my_var in 1.pl is not reflected in 2.pl. Please let me know where I am wrong."
2.pl loads a fresh copy of my_module.pm with our @my_var = (1..10); — it knows nothing about changes made by 1.pl.
"Please suggest if I should take any other approach."
While it's good that you've provided a minimal example to demonstrate the problem, we'll need to know a bit more about what you're trying to achieve in order to advise on a better approach. Some possibilities are (in no particular order):
[While Exporter was not the way to go here, your usage is generally not that good for any scenario. For future reference, see Selecting What to Export and What Not to Export.]
-- Ken
In reply to Re: Sharing a variable across multiple files
by kcott
in thread Sharing a variable across multiple files
by bihuboliya
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |