while (defined $dates[0]) { my $days = $dates[0]; my ($year, $month, $day) = Add_Delta_Days(1,1,1, $days - 1); @dates = CreateCal($year, $month, @dates); } exit(0); sub CreateCal { my ($cyear, $cmonth, @dates) = @_; my (@days, @temp); my $days; foreach my $days (@dates) { my ($year, $month, $day) = Add_Delta_Days(1,1,1, $days - 1); if ($year == $cyear && $month == $cmonth) { push (@days, $day); } else { push (@temp, $days); } } if (@temp) { my $new_c = new HTML::CalendarMonth(month => $cmonth, year => $cyear,); push (@cals, $new_c); return @temp; } else { # Embolden headers foreach (@cals) { $_->item($_->month,$_->year)->wrap_content(font({size => '2'})); $_->item($_->dayheaders)->wrap_content(font({size => '1'})); $_->item(@days)->wrap_content(font({size => 4, color => 'red'})); #print "this is getting through"; # Generate container table my $t = new HTML::ElementTable ( maxrow => 1, maxcol => 6 ); # Populate container table foreach (0..$#cals) { $t->cell(0,$_)->push_content($cals[$_]); } print $t->as_HTML; exit; } } }