You are almost there. What you have to keep in mind is that the
my $self = shift;
line in every member function gives you a blessed
reference to the hash.
So instead of writing
$self{theValue}
you should write
$self -> {theValue}
Your modified code in full:
package Test;
sub new {
my $class = shift;
my $self = {};
bless $self, $class;
return $self;
}
sub getValue {
my $self = shift;
$self -> {theValue}; # note '->'
}
sub setValue {
my $self = shift;
my $value = shift;
$self -> {theValue} = $value; # note '->'
}