my $mhonarc = "/usr/local/bin/mhonarc"; # Path to Mhonarc executable my $archive = "/home/httpd/html/archive"; # Path to archive my $rcfile = "/home/httpd/mhonarc.rc"; # Path to Mhonarc rcfile my ($m,$y) = (localtime(time))[4,5]; $m++; $y+=1900; my $month = sprintf("%04d%02d", $y, $m); # make a directory name like YYYYMM unless (-e "$archive/$month") { mkdir("$archive/$month", 0775) || die "Couldn't make new archive dir: $!\n"; } open(OUT, "|$mhonarc -add -rcfile $rcfile -outdir $archive/$month -quiet") || die "Couldn't open mhonarc: $!\n"; while() { print OUT; } close (OUT);