I am wondering how I can cache the output of some commands invoked in my perl script? The reason why I do this is that every invoke of some command can be very expensive, so I don't want to run the commands everytime when I run my Perl script, I want to cache the result, and run the command only if the result is too out of date.
My idea is using temporary files for each command output, and use the time stamp of each file to know if that output is out of date or not.