Hi Monks,
I would like to place "-" into string A based on the position they are in string B.
Basic Idea:
ABABA goes to AB--A-BA based on template BB--B-BB
I can do this just by looping over the two strings, as below, but I am wondering if there is a neat perl way of doing it with out using loops?
Thanks for your guidance!
my $j =0;
for($i=0;$i<length($protein);$i++){
my $chr=substr($protein,$i,1);
if($chr ne "-"){
$new_dna=$new_dna.substr($dna,$j,1);
$j=$j+1;
}else{
$new_dna=$new_dna."-";
}
+
+
+ }