in reply to CGI, cookies, sendmail, HTML attachments, searching txt files,

Question 2 (code not tested):

sub checkemail { my $email = shift; open IN, "/some/textfile.txt" or die "errormessage"; while (<IN>) { chomp; return "already added" if $email eq $_; # if textfile.txt has one email address per line # and nothing else } close IN; return; }

Update (thanks to Hofmator for showing the obvious): dropped that error

This can be improved, but it should work. Hope it helps.

alex pleiner <alex@zeitform.de>
zeitform Internet Dienste

  • Comment on Re: CGI, cookies, sendmail, HTML attachments, searching txt files,
  • Download Code

Replies are listed 'Best First'.
Re: Re: CGI, cookies, sendmail, HTML attachments, searching txt files,
by Hofmator (Curate) on Oct 26, 2001 at 13:45 UTC
    return "already added" if $email eq chomp($_);

    This has to be replaced by

    chomp; return "already added" if $email eq $_;
    as chomp returns the number of characters chomped. Common mistake ;-)

    -- Hofmator