... for $year ($start_year .. $end_year){ if ( ($year eq $start_year) ){ $min_month = $start_month; } else { $min_month = 1; } if ( ($year eq $end_year) ){ $max_month = $end_month; } else { $max_month = 12; } for $month ($min_month .. $max_month){ $date = new Date::Handler({ date => { year => $year, month => $month, day => 0 },}); if ( ($year eq $start_year) && ($month eq $start_month) ){ $min_day = $start_day; } else { $min_day = 1; } if ( ($year eq $end_year) && ($month eq $end_month) ){ $max_day = $end_day; } else { $max_day = ($date->DaysInMonth()); } for $day ($start_day .. $max_day){ $date = new Date::Handler({ date => { year => $start_year, month => $month, day => $day },}); $week_day = $date->WeekDayName(); push(@work_days, $week_day.';;'.$day.';;'.$month.';;'.$year) unless ( ($week_day eq 'Saturday') || ($week_day eq 'Sunday') ); } } } ...