mytest4:
package mytest4;
use strict;
use warnings;
our sub setvar
{
my $self = shift;
my $symbol = shift;
my $value = shift;
$self->{$symbol} = $value;
}
our sub getvar
{
my $self = shift;
my $symbol = shift;
$self->{$symbol};
}
our sub new
{
my ($myclass) = @_;
my $self = {};
bless $self, $myclass;
$self;
}
1;
The following is a test program:
use mytest4;
use strict;
use warnings;
my $obj = mytest4->new;
$obj->setvar('xyz','abc');
print $obj->getvar('xyz');