Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   How to upper case letters in a pair of parenthesis by PERL? (http://www.velocityreviews.com/forums/t911807-how-to-upper-case-letters-in-a-pair-of-parenthesis-by-perl.html)

 sofin 11-17-2009 10:21 AM

How to upper case letters in a pair of parenthesis by PERL?

Input:
"Modeltest: testing the model of (dna)-substitution"

Output:
"Modeltest: testing the model of DNA-substitution"

Anyone knows how to do it by PERL? Thanks.

 C.DeRykus 11-17-2009 10:36 AM

Re: How to upper case letters in a pair of parenthesis by PERL?

On Nov 17, 2:21*am, sofin <ken.so...@gmail.com> wrote:
> Input:
> "Modeltest: testing the model of (dna)-substitution"
>
> Output:
> "Modeltest: testing the model of DNA-substitution"
>
> Anyone knows how to do it by PERL? Thanks.

perldoc -f uc
perldoc perlop (see \U in Quote and quote-like operators)

--
Charles DeRykus

 Jochen Lehmeier 11-17-2009 01:00 PM

Re: How to upper case letters in a pair of parenthesis by PERL?

wrote:

> sofin <ken.sofin@gmail.com> wrote:
>> Input:
>> "Modeltest: testing the model of (dna)-substitution"
>>
>> Output:
>> "Modeltest: testing the model of DNA-substitution"
>>
>> Anyone knows how to do it by PERL?

> Sure. That is pretty easy to do in Perl.

s/\((\w+)\)/uc(\$1)/eg

 Willem 11-17-2009 01:31 PM

Re: How to upper case letters in a pair of parenthesis by PERL?

Jochen Lehmeier wrote:
) wrote:
)
)> sofin <ken.sofin@gmail.com> wrote:
)>> Input:
)>> "Modeltest: testing the model of (dna)-substitution"
)>>
)>> Output:
)>> "Modeltest: testing the model of DNA-substitution"
)>>
)>> Anyone knows how to do it by PERL?
)
)> Sure. That is pretty easy to do in Perl.
)
) s/\((\w+)\)/uc(\$1)/eg

I think \U is preferrable to /e.

SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT

 Randal L. Schwartz 11-17-2009 03:32 PM

Re: How to upper case letters in a pair of parenthesis by PERL?

>>>>> "sofin" == sofin <ken.sofin@gmail.com> writes:

sofin> Anyone knows how to do it by PERL? Thanks.

I'm pretty sure the Protecting Escarpment Rural Lands organization
homework. And I'm not even sure that your Pupils are Equal, Reactive to Light
at this point either.

When you have a non-homework question about the Perl programming language,
feel free to post again. :)

print "Just another Perl hacker,"; # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

 sln@netherlands.com 11-17-2009 10:31 PM

Re: How to upper case letters in a pair of parenthesis by PERL?

On Tue, 17 Nov 2009 07:32:52 -0800, merlyn@stonehenge.com (Randal L. Schwartz) wrote:

>>>>>> "sofin" == sofin <ken.sofin@gmail.com> writes:

>
>sofin> Anyone knows how to do it by PERL? Thanks.
>
>I'm pretty sure the Protecting Escarpment Rural Lands organization
>homework. And I'm not even sure that your Pupils are Equal, Reactive to Light
>at this point either.
>
>When you have a non-homework question about the Perl programming language,
>feel free to post again. :)
>
>print "Just another Perl hacker,"; # the original

You mean Perl is actually offered as a HS or college course and with homework?
I find that hard to believe. It serves no purpose and has no reward.

-sln

 All times are GMT. The time now is 10:00 PM.