{ my @cache = (0, 1); # Localized so only &Fib sees it. sub Fib($) { my $index = shift; return $cache[$index] if defined $cache[$index]; $index -= $#cache; push @cache, $cache[-1] + $cache[-2] while $index--; return $cache[-1]; } }