$this->{_coderef} = sub{ return "Don\'t think so"; }; ## ... and later: printf "%s\n", $this->{_coderef}->();