Passing data to perl script from Web page

D

\Dandy\ Randy

Hey peoples, perhaps you could help me with this tricky code I'm hoping to
build. I have developed a small emailing program for my business. At the
bottom of the emails that get sent out, there is an option for a recipient
to remove themselves from my mailing list.

Here is what I am looking to do. At the bottom of the email, the removal
link would contain something like this:

To remove yourself from my mailing list, click here:
http://www.mysite.com/cgi-bin/[email protected]

I am looking to have my perl script read the referring link and detect the
user= tag ... them perform the necessary function to splice that email from
my database ... Can Perl do this? Below is an example of the theoretical
code. Note: the second line is not valid perl code obviously, simply my
goal:

#!/usr/bin/perl

$theuser = HTTP{REFFERAL_TAG, 'user'}; #scan the reffering html URL for the
"user" variable

open (ADDRESSES, "<data/addressbook.txt") or !die ("Unable to open");
@recipients=<ADDRESSES>;
close(ADDRESSES);

foreach $recipients(@recipients) {
$count++;
if ($recipients =~ /$theuser/i) {
$count--;
splice(@recipients, $count, 1);
}

print "Location: $confpage\n\n"; #redirects to a confirmation page

Please let me know if this can be done, and/or if it cannot be done and you
have an alternate idea. Code examples are welcomed. Thanx everyone!

Randy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top