Jun 22, 2008

Make first letter of every word in a string to Upper case

#!F:\Perl\bin\perl -w
use strict;

my $text = 'india is a great country';
print "\n Before:", $text; # india is a great country
$text =~ s/(\w+)/\u$1/g; # \u option is used
print "\n After :", $text,"\n"; # India Is A Great Country

No comments:

Post a Comment