Now @array is visible only within foo and bar. If you want to refer to it outside of those, you'll need to pass a copy or a reference to @array to the outside world.{ my @array; sub foo { } sub bar { } }
(update) Of course, daveorg's got the answer to the obvious XY problem.
In reply to Re: Sharing a variable between subroutines
by clintp
in thread Sharing a variable between subroutines
by professa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |