Created
September 9, 2010 05:03
-
-
Save mfollett/571400 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| my %cache = {}; | |
| sub long_running_thing { # imagine your own long running method here | |
| my $x = shift; | |
| return $cache{$x} if( exists $cache{$x} ); | |
| my $result; | |
| # do some long running thing, generate result | |
| return $result; | |
| } | |
| } | |
| say long_running_thing(42); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment