Create your variable privately then don't pass it outside of your package. Likely you want to use my to create the variables.
I am confident that you do not want to be using function prototypes on any of these routines. That is you want: sub function {# do stuff instead of sub function($) { #do stuff
Function prototypes are a completely different beast in Perl from those in C or C++. You very rarely want them. To emulate the control that C-style prototypes give you you explicitly check @_.
Good perling.# off-hand code sub some { croak "Bad arg count to some" unless @_ == 2; croak "First arg to some not a ref" unless ref $_[0]; # etc. etc. return do_stuff(); }
In reply to Re: Package-Level Variables
by rir
in thread Package-Level Variables
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |