I you just say

use strict;

my $full_address = '"My Name" <[EMAIL PROTECTED]>'
my ($user, $email) = split (/</,$full_address);
$user =~ s/"//g; # remove the " in the name, you could perfect it so that it
only removes the first and last one, keeping Robert "bob" Ducharme as $name with
the " in it
$email =~ s/>//g; # remove the last > in the adress

print "hello $user, is $email you adress?\n";

Etienne

"Watkiss, Stewart" wrote:

> Hello,
>
> This is a resend of my earlier email. Apologies to anyone that couldn't read
> my earlier email - I forgot to change the formatting to plain text. How
> outlook express can let you specify a format per user, but outlook 2000
> can't I'll never know.
>
>
> I have a program that deals with Email addresses. The addresses are in the
> form "Name" <emailaddress> which is a single string:
> ie.
>
> "My Name" <[EMAIL PROTECTED]>
>
> I need to seperate the comment part (ie. the users name) from the email
> address part.
>
> $full_address = '"My Name" <[EMAIL PROTECTED]>'   # Read from a file
> ($user, $email) = split /</, $full_address;
>
> The problem is that I can't get the split to work on the '<' character. I've
> tried different permatations including \< and [<] etc., but it never seams
> to match on the triangular brackets. Does anyone know how this could be
> achieved.
>
> Thanks
> Stewart
>
> --
> Stewart Watkiss
> AT&T GNS EMEA Security Solutions - Security Analysis
> [EMAIL PROTECTED]
> PLEASE reply to [EMAIL PROTECTED], please do not
> use my ibm email address for any future correspondence
> This message and any attachments to it contain confidential business
> information exclusively intended for the recipients. Please do not forward
> or distribute it to anyone else. If you have received this e-mail in error,
> please call +44 1926 464052 to report the error and then delete this message
> from your system.
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to