Your regexp is too "expensive". You do not need capturing.
Simply delete everything up to a whitespace:
use warnings; use strict; my $contact = "Firstname Lastname"; $contact =~ s/^.*\s/Mr. /; print "$contact\n";
In reply to Re^2: Strip first name from string
by Skeeve
in thread Strip first name from string
by htmanning
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |