in reply to join email lists with comma unless one list is empty

You shouldn't have to think about it. Perl has join, which automatically inserts the chosen character between list elements, but not before or after.

sub join_lists { return join ',', @_; }

Or if you want to get cute with double-quote interpolation:

sub join_lists { local $" = ','; return "@_"; }

Possibly I'm just not alert enough to spot why simple join isn't exactly what you're after, but it seems to me there's a simple answer.


Dave

Replies are listed 'Best First'.
Re^2: join email lists with comma unless one list is empty
by AnomalousMonk (Archbishop) on Jun 10, 2011 at 22:45 UTC
    ... why simple join isn't exactly what you're after ...

    Because Gulliver wants, for some reason, to have empty strings in the e-mail address list, and these need to be filtered out as Perlbotics and wind do.

      Does it say that somewhere in his question?

      Gah! I knew something was wrong with me. Up too late reading I guess. ;)


      Dave