Remeber that you can retrieve the slice of an array.
Instead of :
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime;
You could do my($sec,$min,$hour,$mday,$mon,$year,$wday,undef,undef) = localtime;
Notice the undef for the values that are not being used. I would recomend this as then you are not declaring things that will never be used.