Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Strip first name from string

by vinoth.ree (Prior)
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
Replies are listed 'Best First'.
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 romping around the Monastery: (6)
As of 2015-08-03 10:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (30 votes), past polls