This doesn't work:
while ( <DATA> ) {
push @addrs, split /(?:\s+,?\s*|,\s*)/, $_;
}
print Dumper \@addrs;
__DATA__
foo@foo.com bar@bar.com, foo@foobar.com
bar@foo.com , bar@foobar.com
produces the following output:
$VAR1 = [
'',
'foo@foo.com',
'bar@bar.com',
'foo@foobar.com',
'bar@foo.com',
'bar@foobar.com'
];
That empty entry at
$addrs[0] is what I'm trying to avoid.
BlueLines
Disclaimer:
This post may contain inaccurate information, be habit forming, cause atomic warfare between peaceful countries, speed up male pattern baldness, interfere with your cable reception, exile you from certain third world countries, ruin your marriage, and generally spoil your day. No batteries included, no strings attached, your mileage may vary.