On 11/10/06, ppp ppp <[EMAIL PROTECTED]> wrote:

Hi All ;


I am new to this group.I am just started to learn perl.I want to program
in perl or C
that it input text file(.txt) and it should find every Uppercase
letters(Capital letter) in
the input file converts every capital letter say with one letter d and
lower case letters(small letters) replaces with letter O.

for eg.(input file- eg1.txt)
>protein1
afagaDRTYUagagfaa
>protein 2
DFafagagRTUI

output file (eg2.txt)
>protein1
ooooodddddooooooo
>protein2
ddoooooodddd

My code

while($string=<>) {
$string=~ tr/[A-Z,a-z]/[d,o]/ ;
print $string ;}

Please help me



---------------------------------
Sponsored Link

Mortgage rates near historic lows: $150,000 loan as low as $579/mo.
Intro-*Terms


Hi,

U can try with the below

$string=~s/([A-Z])/d$1/ ;
$string=~s/([a-z])/o$1;

Regards
Mazhar

Reply via email to