in reply to Re: Replacing between patterns
in thread Replacing between patterns

Similarly, but with /m and $:
echo "123 ABC 123 abc XYZ hi la" | perl -0777 -pe 's/ ABC .*? XYZ .*? $ /[DATA]/msx' 123 [DATA] la