# Fred Marton <Fred.Marton@uni-bayreuth.de>
#
# Note: Running this with the -w flag generates the following warnings:
-# Scalar value @word[1] better written as $word[1] at /path/to/convert_mbox.pl line 44
-# Scalar value @word[0] better written as $word[1] at /path/to/convert_mbox.pl line 46
+# Scalar value @word[1] better written as $word[1] at /path/to/convert_mbox.pl line 54
+# Scalar value @word[0] better written as $word[1] at /path/to/convert_mbox.pl line 56
# Making these changes requires further changes in the script
# that results in much longer run-times.
#
open (IN, $mbox);
while ($line = <IN>) {
# check for the beginning of an e-mail
- @word = split(/ /m,$line);
+ @word = split(/ +/m,$line);
+# some lines might start with "From ", so check
+# to see if the seventh word is a year
+ chomp($word[6]);
+ $year = $word[6];
# ignore the MAILER-DAEMON message from pine
if (@word[1] ne "MAILER-DAEMON") {
-# start a new file
- if (@word[0] eq "From") {
+# start a new file, assuming $year is > 1970
+ if (@word[0] eq "From" && $year > 1970) {
$i++;
close (OUT);
open (OUT, ">$mh/$i");