$str = q{ 1. This is just a sample. 2. This is to check 3. How a set of values 4. can be replaced by another 5. set of values and that too 6. in the most efficient way. }; $str =~ s/^(\d)/chr($1+96)/meg; print $str; ### prints: a. This is just a sample. b. This is to check c. How a set of values d. can be replaced by another e. set of values and that too f. in the most efficient way.