$cutoff = time() - 31*24*60*60; while() { unlink $_ if (stat $_)[10] < $cutoff; }