#!/usr/bin/perl5 use Getopt::Std; getopt('f:h:a:'); if(defined $opt_a) { $args = $opt_a; } else { $args = '-guid .'; } if(defined $opt_f) { $file = $opt_f; } else { $file = 'mbox'; } if(defined $opt_h) { $hypermail = $opt_h; } else { $hypermail = '/var/adm/sm.bin/hypermail'; } open MBOX, $opt_f or die "can't read the mbox."; while() { if(/^From / && defined @lines) { print '.'; open HYPERMAIL, "|$hypermail $args" or die "can't pipe to hypermail."; print HYPERMAIL @lines; close HYPERMAIL or die "can't close hypermail"; undef @lines; } push @lines, $_; } close MBOX or die "can't close mbox";