#!/usr/local/bin/perl
# Calls the system 'cal' function to display a calendar
# Script: calendar1.pl
$CAL='/usr/bin/cal';
$DATE='/bin/date';

# Fetch the current year using the Unix date
# command
chop($year=`$DATE +%Y`);

# Fetch the text of the calendar using the cal
# command
chop($calendar_text=`$CAL $year`);

# Print it all out now
print <<END;
Content-type: text/html

<HTML><HEAD>
<TITLE>Calendar for Year $year</TITLE>
</HEAD><BODY>
<H1>Calendar for Year $year</H1>
<PRE>
$calendar_text
</PRE>
<HR>
<A HREF="/">Welcome Page</A>
</BODY></HTML>
END
