Try perhaps this:
print OUTPUT $1 and last if /(.*)END/; [download]
In reply to Re: Weird file extraction problem by Laurent_R in thread Weird file extraction problem by knight.of.ni