March 2002 Perl Hardware Store 24

5. Caching

        {
          my %cmyk;
          sub cmyk {
            my $key = join ',' , @_;
            return $cmyk{$key} if exists $cmyk{$key};
            $cmyk{$key} = real_cmyk(@_);
          }
          sub real_cmyk {
            # as before...
          }
        }


Next Copyright © 2002 M-J. Dominus