View Single Post
Old 08-10-2002, 01:53 AM   PM User | #1
cedsn
New Coder

 
Join Date: Aug 2002
Location: san marcos TX
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
cedsn is an unknown quantity at this point
capitalizing variables for display

I'm sure this is something simple, but as I'm a bit new to regular expressions, it's giving me a headache.

what i want to do is take a character string of varying lengths of words and capitalize every word.. i have so far suceeded in taking of the first letter and lowercasing the rest as follows:

$brand =~ s/\w//;
$brand =~ tr/A-Z/a-z/;

and i assume there must be some way to put the first character in another variable and capitalize it, then put them back together.. but most likely i'm going about it all wrong. Can anyone tell me the easy way to do this?

thanks, jesse
cedsn is offline   Reply With Quote