#!/usr/bin/perl -w use strict; use CGI ':standard'; use Date::Calc qw(:all); #definitions: #========= print "Content-type: text/html\n\n"; my @calendar = qw~732235 732236 732237 732238 732239 732240 732312 732313 732314 732315 732316 732317 732318 732319 732320 732321 732322 732323 732324 732325 732326 732327 732328 732329 732330 732331 732332 732333 732334 732335 732336 732337 732338 732339 732340 732341 732342 732343 732344 732345 732346 732347 732348 732349 732350 732351 732352 732353 732354 732355 732356 732357 732358 732359 732360 732361 732362 732363 732364 732365 732366 732367 732368 732369 732370 732371 732372 732373 732374 732375 732376 732377 732378 732379 732380 732381 732382 732383 732384 732385 732386 732387 732388 732389 732390 732391 732392 732393 732394 732395 732396 732397 732398 732399 732400 732401 732407 732408 732409 732410 732411 732412 732413 732414 732415 732416 732417 732418 732419 732422 732423 732424 732425 732426 732427 732428 732429 732430 732431 732432 732433 732434 732435 732491 732492 732493 732494 732495 732496 732497 732498 732499 732500 732501 732502 732503 732504~; my @Calendararray = qw~732357 732358 732359 732360 732361 732362 732363 732364 732365 732366 732367 732368 732369 732370 732371 732372 732373 732374 732375 732376 732377~; my $e; my (@union, @intersect); my (%union, %intersect); my $count = 0; foreach my $e (@calendar) { $union{$e} = 1 } foreach $e (@Calendararray) { if ($union{$e}) { $intersect{$e} = 1 } $union{$e} = 1; } @intersect = keys %intersect; @union = keys %union; $count = @intersect; my %dates; my @alldays; my @alldays1; for ( @intersect ) { my ( $year, $month, $day ) = Add_Delta_Days( 1, 1, 1, $_ - 1 ); push @{ $dates{$year}->{$month} }, $day; } @calendar = sort @calendar; @Calendararray = sort @Calendararray; @intersect = sort @intersect; print "@calendar"; print "

"; print "@Calendararray"; print "

"; print "@intersect"; print "

"; my @linetoprint; my $statement; for my $year (sort keys %dates) { for my $month (sort keys %{$dates{$year}}) { @alldays = @{$dates{$year}{$month}}; my @months = qw (January February March April May June July August September October November December); my $m_w = $months[$month -1]; foreach my $item (@alldays) { $item = sprintf ('%02d', $item); push (@alldays1, $item); } @alldays1 = sort (@alldays1); $statement = "$year: $m_w,  @alldays1"; push (@linetoprint, $statement); } } $statement = join "
\n", @linetoprint; print "$statement";