Associative arrays

They have: 11 posts

Joined: Nov 1999

Hello,

I am trying to add a subroutine to send mail if a user joins our banner exchange and only our banner exchange. The problem is finding out if the key for the banner exchange matches the value they choose. The program is webadverts and below if it shows up is the associative array, and how the value is picked from the array and sent to a web page for the user to copy. Is there a way to know if the user chooses the banner exchange and only sends them an email if they do?

%nonssi_cgis = (
'Banner exchnage','http://foo.com/ads/ads_1.pl',
'Zone2','http://foo.com/ads/ads_2.pl',
'Zone3','http://foo.com/ads/ads_3.pl',
);

if (%nonssi_cgis) {
foreach $setzone (keys %nonssi_cgis) {
if ($displayzone eq $setzone) {
$nonssi_cgi = $nonssi_cgis{$setzone};
}
}
}
Then in the html returned to the user the $nonssi_cgi is replaced with the appropriate zone they chose. I need the key to the $nonssi_cgi if the value of $nonssi_cgi equals the banner exchange.

I hope that code shows up!!

thanks for any ideas,
Ray

They have: 15 posts

Joined: Jun 2000

$nonssi_cgis{'Banner exchnage'}

------------------

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.