Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 perusing the Monastery: (5)
As of 2014-11-27 05:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (180 votes), past polls