Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Strip first name from string

by vinoth.ree (Parson)
on Jan 29, 2014 at 07:13 UTC ( #1072449=note: print w/ replies, xml ) Need Help??


in reply to Strip first name from string

use warnings; use strict; my $contact = "Firstname Lastname"; #my $contact = "G. Lastname"; my ($Fname,$Lname) = split(' ',$contact); if($Fname =~ /.*\./ ) { print join (' ', ('Mr',$Fname,$Lname)); } else { print join (' ', ('Mr',$Lname)); }

All is well


Comment on Re: Strip first name from string
Download Code
Re^2: Strip first name from string
by hdb (Prior) on Jan 29, 2014 at 07:29 UTC

    /.*\./ is equivalent to /\./

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1072449]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (10)
As of 2014-09-16 22:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (51 votes), past polls