On Fri, 2008-07-25 at 14:27 +0530, V.Ramkumar wrote:
> Hi,
>
> Any one suggest me, what is the error in my below code, Not any error when
> run, But unable to get the search value in replacement.
>
> $content=~s/<$allelm/"<\1 xml:id=".$idseq++/egsi;
>
> Here $allelm contains element list, (para|quote|list).
>
> I am getting output as a junk for \1.
>
> Regards,
> Ramkumar
>
>
>
Use $1 as in:
$content=~s/<($allelm)/"<$1 xml:id=".$idseq++/egsi;
Note the parentheses. Not only is the substitution clearer but it will
work when $allelm is a single item, as in:
$allelm = 'para';
--
Just my 0.00000002 million dollars worth,
Shawn
"Where there's duct tape, there's hope."
"Perl is the duct tape of the Internet."
Hassan Schroeder, Sun's first webmaster
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/