Gossamer Forum
Home : General : Perl Programming :

Re: [over644] Regular Expressions - Converting To Uppercase

Quote Reply
Re: [over644] Regular Expressions - Converting To Uppercase In reply to
Something like this should work;

Code:
#!/usr/bin/perl

use strict;

#Capitalizes The First Letter Of Each Word In The Sentence.

print "Enter A Sentence You Want Capitalized: \n";
my $sentence = <STDIN>;

my $back;
my @list = split / /, $sentence;
foreach (@list) {
$back . = " " . ucfirst $_;
}
}
print $back;

This is untested, but it should work.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Subject Author Views Date
Thread Regular Expressions - Converting To Uppercase over644 9516 Apr 14, 2004, 2:04 PM
Post Re: [over644] Regular Expressions - Converting To Uppercase
dan 9342 Apr 14, 2004, 2:15 PM
Post Re: [over644] Regular Expressions - Converting To Uppercase
Andy 9294 Apr 15, 2004, 3:38 AM