in reply to Find and replace

If I understand your question properly, here is what I would do...
#!/usr/bin/perl use strict; while (<DATA>) { if (/^\<differentiation\>/ ... /^\<\/differentiation\>/ ) { s/\<.*\>/new/g if ! ( /\<differentiation\>/ || /\<\/differenti +ation\>/ ); print; } } __DATA__ <differentiation> <differentiated-content differentiation="Emphasis3" xlink:type="simple +">Dedication</differentiated-content> </differentiation> <differentiation> <para differentiation="Emphasis3" xlink:type="simple">Dedication</para +> </differentiation>

Replies are listed 'Best First'.
Re^2: Find and replace
by Selvakumar (Scribe) on Jun 04, 2009 at 05:23 UTC

    In other words i can say that i need to find some elements in a XML file and i need to process. For example within <para>...</para> or ... etc., to find and replace text, like that. Hope i made clear now.