##
package Acme::Sample::Counter;
sub new {
my $class = shift;
my $ob = (shift || 0);
bless \$ob, $class;
}
sub count {
my $self = shift;
$$self += (shift || 1);
}
sub read {
my $self = shift;
return $$self;
}
##
##
my $counter = new Acme::Sample::Counter ();
$counter->count; # add 1
$counter->count(10); # add 10
say $counter->read;