in reply to Re^2: Avoid memory error while extracting text block
in thread Avoid memory error while extracting text block

If the "end of block" identifier cannot occur inside the document, you could read the file "one document at a time":
open my $fh, "<", "File/name" or die "Could not open file:$!"; $/="</DOCUMENT>"; while (my $doc = <$fh>){ # Process, or search through contents of $doc.... } close $fh;

        This is not an optical illusion, it just looks like one.