in reply to week days in a given date range

Because it's "what I do" ... here's the DateTime solution. I know you're already working in Time::Piece, so you probably want to go with the matching solution above.

use DateTime; my $start_date = new DateTime( year => 2005, month => 10, day => 1 ); my $end_date = new DateTime( year => 2005, month => 10, day => 14 ); while( $start_date <= $end_date ) { push( @{$result{ $start_date->day_name }}, $start_date->clone ); $start_date->add( days => 1 ); }