Help for this page

Select Code to Download


  1. or download this
    my $a = "ABABA";
    my $b = "BB--B-BB";
    ...
    my $a_pos = 0;
    $new =~ s:[^-]:substr($a, $a_pos++, 1):ge;
    print "New is $new\n";
    
  2. or download this
    my $a = "ABABA";
    my $b = "BB--B-BB";
    substr($a, pos($b)-1, 0, '-') while ($b =~ /-/g);
    
    print "A is now $a\n";