in reply to Insert into string

Hi, change your if statement as follows:

if($src =~ /<record[^>]*>/igm){ $src =~ s/$&/$&$new_tag/i; }

Regards,
Velusamy R.

Replies are listed 'Best First'.
Re^2: Insert into string
by Anonymous Monk on Jul 22, 2005 at 07:23 UTC
    Hi ,

    Printing $& will output the following

    <record name="rightnav" type="content"><item name="RHS_Image">

    Which means the $new_tag will be appended after the "item" tag. Which is now what is intended.

    The "$new_tag" is aimed to be inserted after the "<record name="rightnav" type="content">" tags.

    Thanks