#!/usr/bin/perl use strict; use warnings; use Data::Tabulate; use Data::Dumper; use Date::Calc qw(Day_of_Week Days_in_Month); use HTML::Template::Compiled; my $month = 2; my $year = 2007; # nicht jeder monat faengt mit Montag an my $dow = Day_of_Week( $year, $month, 1 ); $dow = 7 if $dow == 1; $dow--; my @array = (' ') x $dow; # bearbeite die tage my @tage; for( @array, 1 .. Days_in_Month($year,$month) ){ push @tage, { TAGESZAHL => $_, CSS => 'irgendein_css', #... }; } # teile in wochen auf my $tab = Data::Tabulate->new(); $tab->min_columns(7); $tab->max_columns(7); my @wochen = map{ {WOCHE => $_} }$tab->tabulate(@tage); # template processing my $template = HTML::Template::Compiled->new( filehandle => *DATA ); $template->param( ALLEWOCHEN => \@wochen ); print $template->output; __DATA__