in reply to Need help! on this piece of code.

Modest further additional note:

You should be able to change :-

my @emails = split(' ');

to just :-

my @emails = split;

since a single space character is the default string to split on.