http://qs321.pair.com?node_id=88807


in reply to Parsing Names in a Text File

Do it in two steps, it makes it much clearer than coming up with one regex to do everything:
my $str = '380|Kelley Gibson-White|6|0|85|14.2|3|17|.176|8|8|1.000|'; # Get the name my ($name) = (split /\|/, $str, 3)[1]; # Initialize the first name $name =~ s/(\w)\S*\s+(.*)/$1. $2/; print $name;