Hi Erik

You might like this!


    $givenword =~ s/[a-z]/substr $word, pos $givenword, 1/egi;

Cheers,

R


----- Original Message -----
From: "Erik Browaldh" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 11, 2002 4:01 PM
Subject: Re: help with substitution


> Hi!
>
> no, its still not changing the letters (but thanks Rob)..
>
> I have a string:
> $givenword="YY-"
>
> and another string (the original)
> $word="not"
>
> now I want $givenword to look like this:
> $givenword="no-"
>
> ?
>
> thanks in advanced!
> Erik
>
>
>
> Rob Dixon wrote:
>
> >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
> >
> >
> >
> >
>
>
>
> --
> 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]

Reply via email to