in reply to
Calc last friday of month
Find the day of the week of the first day of the month (using Date::Calc, DateTime, localtime or whatever).
Find the number of days to add or subtract.
Days to first Monday:
$days_to_first_monday = ($dow + 7 - 1) % 7;
Days to previous Friday:
$days_to_last_friday = ($dow + 7 - 5) % 7 - 7;
In both case, $dow is expected to hold 1..7 for Mon..Sun or 0..6 for Sun..Sat
Use Date::Calc or DateTime to perform the math.
I make decisions, and my brain carries them out
My brain makes the decisions, and I observe them (if I'm lucky)
I make some decisions, and my brain makes others
My spouse makes decisions and I and my brain carry them out
I wrote a program to relieve me and my brain from the burden of decision-making
The black-helicopter people project the decisions into my brain and then I do as ordered
Results (389 votes),