in reply to <<EOF syntax for reading into string

You missed a "=". Try $x = <<"EOF";