Hi,

Here is a code that does what you want and it works if the name has more
than 2 names. I've tried an example with a First name, a last name and a
middle name but it works for more names also.

my $name = "Sarah Mohrley Washington";
my @initials = map /^(\w)/, split /\s+/, $name;
print "@initials";

The result is:
S M W

You have those initials in an array and you can use them more simple, do
something with each one and the code is very short.


Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]

----- Original Message -----
From: "Sara" <[EMAIL PROTECTED]>
To: "org" <[EMAIL PROTECTED]>
Sent: Monday, July 21, 2003 2:37 AM
Subject: Regex problem


$name = "SARA DEILEY";

how its possible to grasp only initials for First and Last name i.e $name
="SD"??

thanks.



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

Reply via email to