Ben Hammersley’s Daily Doonesbury Feed, refactored:
#!/usr/bin/perl -w use strict; use integer; use XML::RSS; my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time); my $this_year = 1900 + $year; my $todays_date = sprintf( "%02d%02d%02d", $this_year % 100, 1 + $mon, $mday ); my $db_url = 'http://images.ucomics.com/comics/db/' . $this_year . '/db' . $todays_date . '.gif'; my $rss = XML::RSS->new(); $rss->channel( title => "Doonesbury" ); $rss->add_item( title => 'Doonesbury for ' . sprintf( "%05d/%02d/%02d", $this_year, 1 + $mon, $mday ), link => $db_url, description => '<img src="' . $db_url . '" />' ); print "Content-type: application/xml+rss\n\n", $rss->as_string; exit;