use Memoize; memoize('ReallyComplexFunction'); # everything else stays exactly the same....