use 5.010; # for //=, but can be rewritten without it sub lazy_foo { $_[0]->{lazy_foo} //= $_[0]->construct_foo; }