"Stu Miller" <smiller(_at_)taratec(_dot_)com> wrote:
For various reasons I need to run mhonarc from a cron job at about 3 am
every day. I have successfully done this using a cron job that executes a
modified version of the webnewmail script found in the FAQ. However, I
currently have to hard code the input file name and remember to change it
What I would like to do is modify the @ARGV parameters to automatically take
the correct input file from the list archives. The files are named list.yymm
(e.g. list.9911) where yy is the 2 digit year and mm is the two digit month.
Not being a perl programmer, I am asking if someone could help with the perl
code to construct the yymm part of the input filename from the system
One more thing - since the script is being run early morning, it will not
process the correct file on the first day of the month unless the script
determines the yymm part based on date of the previous day. Any help
No warranty, TMTOWTDI, etc.
# figure YYMM for yesterday
($mm,$yy) = (localtime(time()-86400))[4,5]; # 24 hours ago
$yy %= 100; $mm++; # start months at 1
$list = sprintf("list.%2.2d%2.2d", $yy,$mm);
or see the Bighorn book ("Perl Cookbook") or
look for Date::Calc in CPAN for more general routines.