return to first page linux journal archive
keywordscontents

Listing 1. Date Program in Perl

#!/usr/bin/perl -wT
use strict;
use diagnostics;
use vars qw($query @now $day $url);
use CGI;  # from http://www.perl.com/CPAN/
# Create an instance of CGI
$query = new CGI;
# Get the current time and date
@now = localtime(time);
# Get the day of the week from @now
$day = $now[6];
# Create the URL
$url = "/file-$day.html";
# Redirect the user to the appropriate graphic
print $query->redirect($url);