in reply to If logic fails foreach mistake

You don't indicate what the filestamp() subroutine is doing, but it if it doesn't contain an eval, then the datestamps do not contain what you think they contain. By putting single quotes around $logfile when you pass it to filestamp(), you have prevented it from being interpolated, so instead of a logfile name, you are actually just passing that subroutine the word 'logfile' preceded by a dollar sign.

Also, you have a fundamental flaw in your calculation that determines if the log is from yesterday. If today is the first day of the month, then subtracting one from the date string won't get you yesterday, use something like Date::Calc instead.

And that inner 'foreach($logfile) {', while not causing problems for you, doesn't actually do anything.


We're not surrounded, we're in a target-rich environment!

Replies are listed 'Best First'.
Re: Re: If logic fails foreach mistake
by dga (Hermit) on Mar 13, 2003 at 20:48 UTC

    Come to think of it maybe replace the entire filestamp deal with  if( -M $logfile < 1 ) #less than 24 hours ago or the like