|laziness, impatience, and hubris|
I use 'Memoize' and it is an awesome product. But before I knew about it, I did some memorization using a hash. More than 10 years ago I wrote the following code for an editor that I converted from 'traditional C' to Perl:
In *nix the 'tput' command is very expensive, and since I had to support lots of different terminal types, I cached the results using a hash. The results were as good as the 'traditional C' after just a few seconds of use.
Just an alternative.
Update: The original sub didn't have the 'my's. It was only after joining PM and learning of the value of 'use strict; use warnings' that I went back and put the 'my's into the code. I'm sure I've updated it in more than one place. It's currently on my mind since I received a package of xml files on Thursday without any "\n" and I added an '-xml' option the next day. After 2-3 hours of coding, I have a XML formatter that show the proper indention and structure for all(mine) XML files.
"Well done is better than well said." - Benjamin Franklin
In reply to Re: Reminder to self: must use Memoize more often!