in reply to timelocal error when executed twice.

Don't use $y-=1900, use $y-1900 instead.  As you have it, your value will be decremented twice, yielding an invalid year the second time.  (I'm supposing you're setting $y once somewhere at the beginning — though you haven't shown it...)

P.S.: In case anyone wonders (as I did) why when the module croaks the year value is reported as 109 (though it isn't)...  that's because the module does:

... $year += 1900; croak "Cannot handle date ($sec, $min, $hour, $mday, $month, $year +)";

Replies are listed 'Best First'.
Re^2: timelocal error when executed twice.
by Anonymous Monk on Oct 19, 2009 at 17:57 UTC
    Almut ++ you're right. The '-=1900' was the problem. Thanks.