in reply to Need help with a loop (i think)

since it is a daily script , I advice you of using Date::Manip it is powerfull enough to deal with date and kron scripts .