[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Re: search and replace



Boy--you have become my partner in crime!

Thanks for the response.  I got really confused!

PS:  am working on verification techniques for my forms right now.

wouldn't HTML specification 3.x be nice if it added that?

grin


Jann
>J. Linder wrote:
>>
>> I asked how to capitalize the first letter of each word, and Efigenio
>> Vieira de Ataide (thank you) sent me the following:
>>
>> $me = 'string to be capitalized';
>> $me =~ s/(\w+)/\u\L$1/g;
>> print $me;
>>
>> This works!  (Thanks) but, can someone explain it?
>> I know the =~ means "search and replace string is same"
>> s means search for whatever is in between the next two "/" marks
>> it replaces the first "search" string with what is between the 2nd and
>> third "/"
>> g means "keep going till the end of the string "$me"
>>
>> Now the hard part...can someone translate the interior characters?
>> I looked up "\w+" and "\u\L$1" and couldn't find anything.
>
>OK, this much I know :)
>
>\u  forces the very next letter into UPPERCASE, and only that letter.
>\L  forces ALL the following letters into lowercase
>
>Not sure about the rest of it, as I'm also still learning Perl! :)
>
>
>reisa@plinet.com
>http://www.plinet.com/~reisa


**
Hate is NOT a "Family Value"!
professional site:  http://www.jann.com/
personal site:       http://www.jann.com/jann/
email:                  mailto:webmaster@jann.com
**



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch