package Foo; sub new { return bless ( { count => 1 } ) } sub count { $_[0]->{count}++ } 1;