sub rfc822_addr {
  my ($s) = @_;
  $s =~ s/<|>//g;
  my ($s1,$s2) = ($s =~ /(.*\s)*(.+\@.+)/ );
  $s2 =~ s/ |\t//g;
  $s = ( (defined $s1) ? "$s1 <$s2>" : "<$s2>");
  return $s;
}

Example 1: A subroutine that returns the envelope address and user's real name, if present, in an e-mail message field.

Back to Article