in reply to how to do replace more then one matches?

I guess it is the $' at the end of your line $rep=$front."<aid=".$match_key.$';. I you remove it you get something like the desired output.

Replies are listed 'Best First'.
Re^2: how to do replace more then one matches?
by virudinesh (Acolyte) on Jun 03, 2013 at 09:08 UTC

    $f variable r store in $'(after match)

    both r same

      $li ="abbjghfg table 1 vinoth figer table2"; $f=$li; while($f=~m /table[ ]([0-9])+|table([0-9])+|fig[ ][0-9]+|fig[0-9]+/i) { $f = $'; $match_key=$&; $front=$`; $rep=$front."<aid=".$match_key; print $rep; }