Curt Shaffer wrote:
I am really stuck here. I need to split values from a csv value and push
them into an array, then perform a routine for all of them in a foreach
statement. In this example I am reading an email address, a username and a
password and needing to send each user listed in the csv a mail to the email
address with the message containing their username and password. I am
successful in reading the lines of the file and the ability to iterate
through them with once they are in the array, but then how do I get them
into variables to be used by the sub? Again in this example, I need to
create a variable ($to) from the first value, a username ($username) from
the second value and a password($password) from the third value. Those
variables will obviously be different for each iteration through the
foreach.

Parsing CSV is difficult since it uses a double escape mechanism. I suggest you go to CPAN and download a module to do the work for you.

http://search.cpan.org/search?m=module&q=csv&s=1&n=100

I normally don't do work like this (I push it off onto junior programmers, it builds character ;) so implementation is once again left as an exercise for the reader.


--

Just my 0.00000002 million dollars worth,
   --- Shawn

"Probability is now one. Any problems that are left are your own."
  SS Heart of Gold, _The Hitchhiker's Guide to the Galaxy_

"This statement is true but unprovable."
  Kurt Godel

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to