#!C:/Perl/bin/perl -w use strict; use CGI ':standard'; my $MAX = 10; # maximum in list my %list = (); my $confirm = param('confirm'); my $Email_List = param('Email_List'); # extract email adressess between () while ( $Email_List =~ m/\(([^)]+)/g ){ my $addr = $1; # remove spaces and any other cleaning here # assuming you don't have unusual addresses like # "Any Person"@somewhere.com $addr =~ s/ //g; # check valadity if ( is_valid($addr) ){ $list{$addr} = 'Not sent'; # using key avoids duplicates } } # check not too many my $msg; my $no = scalar(keys %list); if ($no > $MAX){ $msg = "ERROR - $no is too many to send"; } else { # send emails if confirm checked if ($confirm){ for (keys %list){ $list{$_} = send_to($_); # store result } } } # input form print header(), start_html; print qq!

Recipients (maximum $MAX)



Confirm

$msg!;