in reply to stripping email address regex

How about:

my @emails = (split(/\s*,\s*/, $email))[0..2];

Update: If you want to detect extras:

my @emails = split(/\s*,\s*/, $email); if (@emails > 3) { ... warn ... } # Keep only the first three. splice(@emails, 3);

Update: oh, if you don't want an array:

$email = join(', ', (split(/\s*,\s*/, $email))[0..2]);

Replies are listed 'Best First'.
Re^2: stripping email address regex
by Fletch (Bishop) on Sep 15, 2005 at 19:09 UTC

    The string "A pain to parse, RFC822 addresses are, hrmm?" <yoda@swamp.dagobah> would have its one address clobbered by that split . . .