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