You just need to declare the variable as a properly scoped lexical.
That should give you both private variables and functions, invisible from outside the file. --Paris Sinclairpackage My::Object; use strict; use warnings; our @EXPORT_OK = qw( private ); my $_private_string = "Hello"; my $_private_code = sub { return $_[0] . " World" }; sub public { return &$_private_code( $_private ); } 1; __END__
In reply to Re: Hiding my variables
by Aighearach
in thread Hiding my variables
by Brovnik
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |