### In Shoe.pm package Shoe; use strict; use warnings; # Shoes with holes in their soles. my %num_holey; sub new { my $class = shift; my $self = {}; # ... bless $self, $class; return $self; } # Instance method that happens to access a class variable. sub wear_out_sole { my $self = shift; $self->incr_num_holey() ; #$num_holey++; print "Sole on this " . ref($self) . " has been worn out.\n"; $self->how_many_holey(); } # Class methods. sub how_many_holey { my $self = shift; local $_; print "Currently, there are $num_holey{$_} holey " . "$_(s).\n" for keys %num_holey; } sub incr_num_holey { my $self = shift; $num_holey{ref($self)}++; } 1;