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 .*?
In reply to Re: How to make substitute greedy like sed's substitute
by Ratazong
in thread How to make substitute greedy like sed's substitute
by PerlJedi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |