What is the syntax to eliminate the following? $dir[0] =~ s/a/A/eg; $dir[0] =~ s/b/B/eg; $dir[0] =~ s/c/C/eg; etc.
physics
12:18 am on Feb 22, 2002 (gmt 0)
This should answer this question and give you some more to think about too. Here is a snippet that will take a sentence and uppercase the first letter of every word and lowercase the rest:
$foo =~ s/([A-Za-z])([A-Za-z]+)/\U$1\E\L$2\E/g;
Key_Master
12:23 am on Feb 22, 2002 (gmt 0)
Or you could go:
$foo = lc($foo); # Converts $foo to lower case. $foo = uc($foo); # Converts $foo to upper case.
Key_Master
12:30 am on Feb 22, 2002 (gmt 0)
Here's a different method to do what Physics described:
$foo =~ s/(\w+)/\u\L$1/g;
mdharrold
12:44 am on Feb 22, 2002 (gmt 0)
Thanks.
gethan
1:31 pm on Feb 22, 2002 (gmt 0)
A simplified version for explanation.
print "\U$string"; # uppercase print "\u$string"; # one character upper