Hmm, to take a step back, what is the problem you are trying to solve with this code? Are you looking to manage size (growth shrinkage) or are you trying to notice if file contents have changed? If the latter is your goal may I suggest using a digest module (MD5) to make a digest of each file, maybe using File::Find along with it to generate the flat file db that you are using to verify file contents. File size does not tell you for sure if a file has changed, amd5 checksum would. Just my 2c