> -----Original Message----- > From: Curt Shaffer [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 07, 2006 11:21 AM > To: Ryan Frantz; beginners@perl.org > Subject: RE: mail list via script > > > > -----Original Message----- > From: Ryan Frantz [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 07, 2006 11:09 AM > To: Curt Shaffer; beginners@perl.org > Subject: RE: mail list via script > > > > > -----Original Message----- > > From: Curt Shaffer [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, March 07, 2006 11:06 AM > > To: beginners@perl.org > > Subject: mail list via script > > > > I have a need to mail 1000 users their usernames and passwords, this > will > > be > > a 1 time thing. I was thinking that I could just do some sort of > foreach > > routine but I can't see how that will work when they will all be > > different. > > I then thought a hash with the usernames and passwords would be OK, > but > > then > > how to I link the proper email account with the proper hash value. I > am > > Since every key in a hash has to be unique, and every email address is > unique, use the email address as the key in your hash: > > my %mailAccounts = ( > [EMAIL PROTECTED] => 'abc123', > [EMAIL PROTECTED] => 'def456', > ... > ); > > > not > > asking for the step by step here but if anyone has some direction for > me I > > would appreciate it and figure it out from there. > > > > > > > > > > > > Thanks > > > > > > > > Curt > > > > > > > > > > > > > Thanks for the response! The problem I have with this solution is I need > to > send both a username and a password (i.e. two values) per email. Can I add > another value to the hash like this: [EMAIL PROTECTED] => > 'abc123','321cba',? >
You may want to look into more complex data structures (hash of arrays, etc.). See the following: perldoc perldata perldoc perldsc In all honesty, however, you may be better served by a simpler approach such a comma-delimited file that you can parse: # emailAddress,username,password [EMAIL PROTECTED],johnsmith,abc123 [EMAIL PROTECTED],janesmith,def456 ry -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>