in reply to Cache Subroutine Return Value
And for those too lazy to write it by hand there's always Memoize and Aspect::Memoize.