{ package foo; sub new { bless {}, shift } sub foo { ++$_[0]{foo} } } $foo = foo->new; $cr = \&foo::foo; print $cr->($foo), "\n" for 1 .. 5;