in reply to Passing Arrays to Subroutines
If you don't know which fields will be email addresses, you can bring Email::Valid along for the ride:open (FILE, '<', 'prev.txt') or die "Can't open prev.txt\n"; while (<FILE>) { my @email = (split('\s',$_))[1..3]; for (@email) { # send email # log results } }
Finally, please consider using MIME::Lite to send the emails. It's really easy to use and it really rocks. :)use Email::Valid; open (FILE, '<', 'prev.txt') or die "Can't open prev.txt\n"; while (<FILE>) { my @stuff = split; for (@stuff) { next unless Email::Valid->address($_); # send email to $_ # log results } }
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Passing Arrays to Subroutines
by shemyaza (Novice) on Nov 26, 2003 at 16:36 UTC |