in reply to String replace, another question

I'm wondering if the OP text got updated after the first few replies were posted... Updating your post is okay, but you really should preserve the original content (e.g. put <strike>...</strike> around stuff to mark it as deleted), and point out what parts have been newly added. It helps to keep the discussion coherent.

As to the problem (as stated in the OP when I read it just now), this is not that different from the last thread you started -- did you happen to try the suggestions given there? (If yes, why not show what you tried? If not, why didn't you even try?)

I'd suggest something like this, IF you are confident that the xml input data is consistent enough to do it this way, without an xml parser (that is, the tags always show up on separate, consecutive lines, as shown in the OP) -- this applies one of the suggestions given by moritz in your previous thread:

my $change_next; while (<>) { if ( /<binddn>cn=xyzzz</ ) { $change_next = 1; } elsif ( $change_next and /<bindpass>welcome1</ ) { s/1/123/; $change_next = undef; } print; }
That'll work as a simple stdin-stdout filter:
perl name_of_script < old_file.xml > new_file.xml