Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

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

by projekt21 (Friar)
on Oct 26, 2001 at 13:26 UTC ( #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
Node Status?
node history
Node Type: note [id://121608]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2021-04-11 00:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?