| Listing 1 listmaker.pl #!/usr/bin/perl
## This script takes an outlook mail list and saves it
## as a mail list for sendmail.  Actually, this will work
## for any list that has the email at the end of each
## line.
## Make sure the alias is in the
## /etc/aliases file and you ran 'newaliases'!
## The input is stdin, the output is stdout
use strict;
while (<>) {            # read each line from STDIN to $_
    chop;            # take EOL off
    if ($_ eq "") { next; }   # no blanks
    if ($_ !~ /\@/) { next; } # don't count stuff without an email address
    if ($_ =~ ":") { next; }  # don't parse header information
    /.+\W(.+\@.+)/;           # get the email address
    print "$1\n";             # print the email address
    #print "$_\n";            # debugging - print the whole line
} |