Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: CGI, cookies, sendmail, HTML attachments, searching txt files,

by projekt21 (Friar)
on Oct 26, 2001 at 13:26 UTC ( [id://121608]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://121608]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-23 19:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found