I am new to Perl and working on a project for school and stuck.
Input: the specified text file containing email addresses, separated by a space, the tab ",", ";" or ":" [may be on separate lines].
I am trying to read email addresses and put them in an array. I can parse the data on one line, however, if there are line breaks or returns, I get only the last element.
Can someone help me figure out how to take a list with each address on a separate line and analyze them? I read a little about regex, but I need a lot more practice. Thanks.
open(EmailAddresses, "EmailAdressesCommaList.txt") || die "Can not open file $!";
while (<EmailAddresses>)
{
chomp;
@lines = split /[ ,;:\t\r\n(\t\r\n\s)+?]/;
}
foreach $value (@lines)
{
print $value . "\n";
}
rakanishuu
source
share