my %cache; while ($foo < $cache{$bar} ||= ReallyComplexFunction($bar)) { doStuff(); }