Use the Date::Calc CPAN module. The function Day_of_Week() gives a numeric value for the day of the week, i.e. monday is 1, etc. Use that on the mimimum date in your range. Also use the Add_Delta_Days() function to keep adding one day to the initial day until you get to the end of the date range. Keep track of the dates that are each weekday.
You'll have to do some playing around to get everything in the format you desire.
Perhaps i'll post a code solution when i get home from work.
I use the most powerful debugger available: print!