in reply to using $1 as find string

Hi Raj,

I think u made a mistake in find pattern... i.e. you should have used \1 and not $1.

But in replace pattern we can use either \1 or $1.

$input='<it>a</it>+2<it>b</it><inf><it>cd</it></inf> <it>a</it>+2<it>b<sup>cd</sup></it>'; $input=~s!</it><(.*?)><it>(.*?)</it></\1>!<\1>$2</$1></it>!sg; print "\n$input";

Thanks,

Gopal.R

Replies are listed 'Best First'.
Re^2: using $1 as find string
by texuser74 (Monk) on Dec 29, 2004 at 06:50 UTC
    Thank you bmann and gopal for your answers, yea now it works fine

    thanks, raj