Hello I want to parse a text file which will be comma delimited, it will look like this:
Basically I want to put all this in an array and then be able to run tests because this will interface with an email program. I want to test for the FOLDER1, SERVER, and TO because I will need to know where who gets what email, about the email addresses there can be many. I tried to use the split() function the only problem is that I have to assign a variable to each field, I thought that the emails that didn't have a field defined for it would get appended to the last variable. THis is what I have so far, If i haven't been clear enough just ask..
thanks guys
Code:
FOLDER1,SERVER,TO,xyz@abc.net
FOLDER1,SERVER,CC,xyz@abc.net,bruce@lee.com,bill@hotmail.com
Basically I want to put all this in an array and then be able to run tests because this will interface with an email program. I want to test for the FOLDER1, SERVER, and TO because I will need to know where who gets what email, about the email addresses there can be many. I tried to use the split() function the only problem is that I have to assign a variable to each field, I thought that the emails that didn't have a field defined for it would get appended to the last variable. THis is what I have so far, If i haven't been clear enough just ask..
thanks guys
Code:
open(fileIN, "emailconfig.txt")or die "Can Not Open Email File:$!\n";
@emailData = <fileIN>;
close(fileIN);
foreach $project (@emailData){
chop($project);
($one,$two) = split(/,/,$project);
print "One:$one Two:$two Three: $three \n";
}