in reply to how do i get yesterday's date using localtime()?

Using Date::Manip:
use Date::Manip; foreach (1..10) { print UnixDate(ParseDate("$_ days ago"),'%c')."\n"; }
The '%c' format prints the date in the same format as scalar(localtime). See the documentation for the different formats you can use with UnixDate().