Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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 (Parson) 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 rifling through the Monastery: (13)
As of 2014-08-27 19:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (250 votes), past polls