in reply to Date::Calc Question
First, consider moving this question to the tail of your previous thread. That would maintain the flow of the conversation.
The code ref in question,
is asking(Delta_Days($3, $months{$1}, $2, $today[2], $today[1], $today[0]) > 30 + )? push @log_lines, $line : keep_line($line);
which could be restated asdate_diff > 30 ? move_line : keep_line
That's what the ?: operator does. Delta_Days returns the number of days between two dates. So the > comparison to 30 fits your original request of finding timestamps more than a month old. [1]if(date_diff > 30) { move_line; } else { keep_line; }
Make sense?
[1] That is if you wish to follow the common convention that a month equals 30 days. If you need to do something like anything less than the current day of month in the previous month you'll need a different test.
|
|---|