in reply to How to make substitute greedy like sed's substitute

The issue is not that you are not greedy enough - you are too greedy.

$scalarWorkingConfig =~ s/.*(XXXXX[ | ]*<$domainProperty .*$domainPr +operty>).*/$1/g;

The first .* is greedy; it tries to catch as much as possible ... which includes all of your <Reasons...> - parts except of the last one.

Try replacing it with .*?

Replies are listed 'Best First'.
Re^2: How to make substitute greedy like sed's substitute
by PerlJedi (Novice) on Mar 30, 2010 at 09:20 UTC

    Thanks Ratazong ... It works fine as required with the .*?