Home: Perl Programming Help: Beginner:
Change first letter to Upper case



waherne
Novice

Jul 14, 2001, 5:07 PM


Views: 904
Change first letter to Upper case

Hi all,

I have a variable called $text ="john",
how do I change $text to "John"?

I have tried hard to change the first letter only but gave up. Your help will be appreciated.

Willie




kiseok7
stranger

Jul 14, 2001, 7:48 PM


Views: 901
Re: Change first letter to Upper case

it is easy.. you can use "ucfirst" function.

look at perlfunc manpage.

print ucfirst "john";


7;


waherne
Novice

Jul 16, 2001, 6:00 AM


Views: 886
Re: Change first letter to Upper case

Thanks 7;

It is indeed so easy once u know where to look!

Willie