in reply to FileCache Usage

You should always say: "open(...) or die $!", or in your case "cacheout(...) or die $!".

You can't just assume that open() worked, as it frequently does not.