#!/usr/pkg/bin/perl use strict ; use lib '/arpa/hm/m/msittig/lib/perl5/site_perl/5.8.6/' ; use Data::Dumper::Simple ; my $items_total = '10' ; my $channelPubDate = `date '+%a, %e %b %y %H:%M:%S +0800'` ; chomp( $channelPubDate ) ; my $t = " " ; print qq{ Micah's Freeshell Mail http://msittig.freeshell.org/ Latest mail in the INBOX of Micah Sittig on his Freeshell account. $channelPubDate A little perl script Micah wrote up. } ; # At least 3 lines for each email in the log my $lines = $items_total * 3 ; my @record_line = split( /\n/, `tail -$lines "$ENV{'HOME'}/.procmail/log"` ) ; my $item_count = 1 ; foreach( @record_line ) { if( /^From (\S*) (\w\w\w .*)$/ ) { my( $addy, $pubDate ) = ( $1, $2 ) ; $pubDate =~ m/^(\w\w\w) (\w\w\w) (\d\d) (\d\d:\d\d:\d\d) \d\d(\d\d)$/ ; $pubDate = "$1, $3 $2 $5 $4 +0800" ; last if $item_count == $items_total + 1 ; print "$t$t\n" if ! ( $item_count == 1 ) ; print "$t$t\n" ; print "$t$t$tFrom $addy\n" ; print "$t$t$t$pubDate\n" ; $item_count++ ; } elsif( /^\s*Subject: (.*)$/ ) { print "$t$t$t$1\n" ; } } print qq{ } ;