Hello Erik It's not clear exactly what you want, but something like this should do the job:
for (my $i = 0; $i < length $word; ++$i) { substr ($word, $i, 1) = '-' unless substr ($givenword, $i, 1) eq 'X'; } HTH, Rob ----- Original Message ----- From: "Erik Browaldh" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, December 11, 2002 8:55 AM Subject: help with substitution > Hi everyone, thanks for the help last time! > > if I have two strings > $word="cows"; > > and another given string: > $givenword="XXX-"; #with the same length as $word !!! > > what I want to do is transform "XXX_" --> "cow-" > > I have tried but cant figure out going characterwise, all I get in the > end is like this: > $givenword="cowscowscows-" > > thanks in advanced! > > Erik > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]