Hi,
Am not sure where I should be renaming the $emailLog file in this sub,
Am I on the right track?
Thanks
Dave
sub addEmail{
my $emailLog = '/email_list/email_list.txt';
# append new email
open(EL,">>$emailLog") || die "Problem: Could not append to $emailLog, $!";
print EL "$email ($realname),\n";
close(EL);
rename("$emailLog","$emailLog.old");
# remove duplicates
open(EL,"$emailLog") || die "Problem, Could not open $emailLog, $!";
my @lines = <EL>;
close(EL);
open(EL,">$emailLog.old") || die "Write file, could not find $emailLog.old, $!";
my %seen;
@lines = sort @lines;
foreach(@lines){
# next if /test/;
$_ =~ s/^\s+(.*)\s+$/\1,/;
print EL unless $seen{$_}++;
}
close(EL);
rename("$emailLog.tmp", "$emailLog");
}
*====================================================*
* Cora Connection Your West African Music Source *
* http://www.coraconnection.com/ *
* Resources, Recordings, Instruments & More! *
*====================================================*
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]