in reply to Re: Strip first name from string
in thread Strip first name from string
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";
|
|---|