Matthew Perry’s upcoming memoir reveals that he came close to death a few years ago after opioid use caused his colon to burst, People magazine reports.

In Friends, Lovers, and the Big Terrible Thing, the Friends star writes that he was in a coma for two weeks, hospitalized for several months, and given a 2% chance to live by doctors who were treating him.

“I was put on a thing called an ECMO machine, which does all the breathing for your heart and your lungs,” Perry told the magazine in an interview. “And that’s called a Hail Mary. No one survives that.”

Perry has been open for years about his struggle with substance use. In a 2002 interview with the New York Times, he talked about quitting drinking, saying, “I didn’t get sober because I felt like it. I got sober because I was worried I was going to die the next day.”

Perry told People that readers of the book will “be surprised at how bad it got at certain times and how close to dying I came. I say in the book that if I did die, it would shock people, but it wouldn’t surprise anybody. And that’s a very scary thing to be living with. So my hope is that people will relate to it, and know that this disease attacks everybody. It doesn’t matter if you’re successful or not successful, the disease doesn’t care."

Friends, Lovers, and the Big Terrible Thing is slated for publication by Flatiron Books on Nov. 1.

Michael Schaub, a journalist and regular contributor to NPR, lives near Austin, Texas.