$name = "SARA DEILEY";
how its possible to grasp only initials for First and Last name i.e $name ="SD"??
Depends on how standardized your data is, something simple like this should work for the above:
my $name = 'SARA DEILEY'; my $initials; if ($name =~ /^(\w)\w*\s+(\w)\w*/) { $initials = $1 . $2; print "Initials: $initials\n"; } else { die "Can't determine initials: $name"; }
But this presents a number of problems, for instance people with 2 "first names", and you will have to decide what to do with names like McDonald, or if your data can be entered by humans, what if someone enters: "Deiley, Sara", etc.
You might also consider using 'split' and 'substr' instead of using a regex.
Either way you need to provide more info about your possible data set range if the above is not sufficient.
http://danconia.org
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]