#!/usr/local/bin/perl # usage: mail.p file1 file2 # reads file1 to get email address and sends file 2 to them. $file1 = $ARGV[0] ; $file2 = $ARGV[1] ; $emailread = 0 ; open ( F1 , "<$file1" ) ; while ( ) { if ( /\s?([\w.-]+@[\w.-]+)\s?/ ) { $email = $1 ; $emailread = 1 ; last ; } } if ( $emailread != 0 ) { print "Sending Mail $email < $file2\n" ; system "Mail $email < $file2\n" ; } else { print "Failed to find email address - $email, \n"; }