Re: grep help request



David Gilden am Freitag, 28. Oktober 2005 20.55:
> Hello,
>
> I am stuck with this issue.
> How do get each substring (the names in this case) and then upper case
> them. This does not work just yet....
>
> Possible data:
> mike smith
> john h. hamilton
> g. bush
> hendric
>
> etc......
> ----
>
> #!/usr/bin/perl
>
> $SendersName = " dave middlename gilden ";
> $SendersName =~ s/\s*(.+)\s*/$1/g;
> ($SendersName) = $SendersName =~ m/([\w\.-]{1,24}( [\w\.-]{1,24}){0,4})/;
> $SendersName =~ s/.+ (.+)? (.+){1,3}/\u$1 \u$2 \u$3/g;
> print "$SendersName\n";

use strict;
use warnings;

my @names=('mike smith', 'john h. hamilton', 'g. bush', 'hendric');

for (@names) {
print join ' ', map ucfirst, split /\s+/;
print "\n";
}

Mike Smith
John H. Hamilton
G. Bush
Hendric


joe

>
>
> Thanks!
>
> Dave Gilden -- Ft. Worth
>
> Island Journey music video now online!
> <http://www.abbydigital.tk/>
>
> ================================================
> Cora Connection: Your West African Music Source
> Resources, Recordings, Instruments & More!
> <http://www.coraconnection.com/>
> ================================================
.



Relevant Pages

  • Re: grep help request
    ... > john h. ... > g. bush ...
    (perl.beginners)
  • Re: US politics has shifted....
    ... >>>We have leftists in this newsgroup triumphantly announcing that Bush ... >>>had to give in to John McCain's provision to prohibit torture. ... >>>2) when pressed about using torture in desperate situations, McCain ... up mercury pollution from power plants. ...
    (alt.politics.bush)
  • Bush Family Involvement in Nazi Industry: Check Out Dave Emorys Interview with John Buchanan
    ... family's involvement with Nazi industry. ... the program sets forth John Buchanan's harrowing ... John's uncovering of the fact that Prescott Bush, ...
    (sci.med.diseases.lyme)
  • Re: Bush Is Crap Said This MP
    ... I have no regrets about making public John Prescott's private thoughts ... should never have made public the fact that Mr Prescott said Mr Bush ... the core dispute in the Middle East: ...
    (alt.religion.islam)
  • Re: Villains Rocky should have fought?
    ... John Wilkes Booth ... where Republicans cannot interfere with a Woman's Right to Choose ... Bush because he is a crony of Halliburton and big business interests & ... Halliburton and big business interests & we hate George W. Bush & ...
    (rec.sport.pro-wrestling)