use strict; use warnings; use CGI::Pretty qw(:standard start_table end_table start_Tr end_Tr), (-unique_headers); use CGI::Carp qw(fatalsToBrowser); print header(); print start_html (-title => "Calendar sample"); my @weekDays = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday); my $today = 11; my @weeks = ( [undef, undef, undef, undef, undef, undef, 27], [28, 29, 30, 31, 1, 2, 3], [ 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17], [18, 19, 20, 21, 22, 23, 24], [25, 26, undef, undef, undef, undef, undef] ); print start_table(); print Tr ({-align=>'CENTER',-valign=>'TOP'}, td (\@weekDays)); for my $week (@weeks) { print start_Tr({-align=>'CENTER',-valign=>'TOP'}); for my $date (@$week) { if (! defined $date) { print td (''); } elsif ($date == $today) { print td(strong($date)); } else { print td ($date); } } print end_Tr(); } print end_html ();