in reply to Re^2: Seeking the right way to override global variables
in thread Seeking the right way to override global variables
And then in your main code or other module, you just use the set and get functions.use strict; use warnings; use Exporter; our @ISA = 'Exporter'; our @EXPORT = qw(get set); my $private_hash_ref = {VAR1 => "one", VAR2 => "two"}; sub get { my $key = shift; return $private_hash_ref->{$key};} sub set { my ($key, $value) = @_; $private_hash_ref->{$key} = $value;}
|
|---|