I think I figured it out. your -s << 'ENDMARKER' is looking for a line that starts with ENDMARKER - no spaces. so you can't indent it nicely.