git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] send-email: allow use of basic email list in --cc --to and --bcc

From
benoît person <benoit.person@gmail.com>
Date
Jun 18, 2013, 10:26 UTC
Message-ID
<CAETqRCjCf0HKfAsgcWPnv81OY07T0JZdXVGGr-DgLsP3miWUvQ@mail.gmail.com>
In-Reply-To
<1371549079-19291-1-git-send-email-Jorge-Juan.Garcia-Garcia@ensimag.imag.fr>
Show 19 quoted lines
> +sub split_email_list {
> +    my(@list) = @_;
> +    my @tmp;
> +    my @emails;
> +       for (my $i = 0; $i <= $#list; $i++) {
> +           if ($list[$i] =~ /,/) {
> +               @emails = split(/,/, $list[$i]);
> +           } else {
> +               @emails = $list[$i];
> +           }
> +           # Removal of unwanted spaces
> +           for (my $j = 0; $j <= $#emails; $j++) {
> +               $emails[$j] =~ s/^\s+//;
> +               $emails[$j] =~ s/\s+$//;
> +           }
> +           @tmp = (@tmp, @emails);
> +       }
> +    return(@tmp);
> +}

Why two regex ? You could do something like : $emails[$j] =~ s/^\s+|\s+$//g; to remove leading and trailing whitespaces at the same time.

I think it's better to use the builin 'push' function to concatenate your two arrays: push(@tmp, @emails);

Benoit Person
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 5 of 13 in “send-email: allow use of basic email list in --cc --to and --bcc”
  1. send-email: allow use of basic email list in --cc --to and --bccjorge-juan.garcia-garcia@ensimag.imag.fr, Jun 18, 2013
  2. Ramkumar RamachandraJun 18, 2013
  3. Mathieu Liénard--MayorJun 18, 2013
  4. Ramkumar RamachandraJun 18, 2013
  5. benoît personJun 18, 2013
  6. Ramkumar RamachandraJun 18, 2013
  7. Mathieu Liénard--MayorJun 18, 2013
  8. Ramkumar RamachandraJun 18, 2013
  9. Matthieu MoyJun 18, 2013
  10. Ramkumar RamachandraJun 18, 2013
  11. Junio C HamanoJun 18, 2013
  12. Matthieu MoyJun 18, 2013
  13. Junio C HamanoJun 18, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.