Millions of people across the globe recognize Matthew Perry's face thanks to his career-defining portrayal of Chandler Bing on "Friends," but the role nearly went to someone else.

Perry, who died at his Los Angeles home last weekend at the age of 54 of unknown causes, detailed the story in his 2022 memoir, "Friends, Lovers, and the Big Terrible Thing." As he described, he was attached to another show at the time and was originally unable to audition for "Friends."

He wrote that in 1994, he was 24 years old and struggling in his acting career, explaining, "Drinking was slowly but surely winning the war against auditions, and no one was really interested in me anyway."

MATTHEW PERRY'S ‘FRIENDS’ CO-STARS GATHER FOR LATE ACTOR'S FUNERAL 

A photo of Matthew Perry

Matthew Perry in 1994, after being cast in "Friends." (Reisig & Taylor/NBCU Photo Bank/NBCUniversal)

His manager had informed him that he'd been getting "daily feedback" that he "looked like a mess" during auditions, and his business manager had told him he was broke. Out of desperation, he reached out to his agents, telling them that he "needed a job, something, anything, and it had to be right then."

MATTHEW PERRY'S DEATH HAS DEVASTATED ‘FRIENDS’ CAST, DIRECTOR SAYS: ‘IT’S A BROTHER DYING' 

From there, Perry landed the lead role in the pilot for a show called "L.A.X. 2194," which he described as a "sci-fi comedy" about baggage handlers at the L.A. airport. The show was set 200 years in the future with aliens acting as the travelers, and the plan was for little people to play the aliens.

Matthew Perry in 92

Matthew Perry, in 1992, was initially unable to audition for "Friends" because he was already working on a show called "L.A.X. 2194." (Ron Galella, Ltd./Ron Galella Collection)

"If all this sounds underwhelming, please know that it was way worse than that," he joked in his memoir.

It wasn't until after he officially received that role that the script for a new sitcom, then titled "Friends Like Us," began creating a lot of buzz. Perry read the script and wanted to be involved, even calling his agents again to beg them to get him an audition. But they told him it wouldn't be possible because he was already involved with "L.A.X. 2194."

HOLLYWOOD MOURNS DEATH OF MATTHEW PERRY: ‘THE WORLD WILL MISS YOU’

"I was devastated," he wrote. "When I read the script for Friends Like Us it was as if someone had followed me around for a year, stealing my jokes, copying my mannerisms, photocopying my world-weary yet witty view of life. One character in particular stood out to me: it wasn’t that I thought I could play ‘Chandler,’ I was Chandler."

A photo of the cast of "Friends"

Matthew Perry was eventually cast on "Friends," something he said saved his life. (Jon Ragel/NBCU Photo Bank/NBCUniversal)

It seemed like he wasn't the only one who thought so – he went on to describe several friends asking him for help with their auditions because the character of Chandler reminded them so much of him. Perry even said he would sometimes read the script himself and tell his friends just to copy his portrayal. Throughout this, he continued to call his agents, still desperate to get involved himself.

Eventually a friend of his, fellow actor Craig Bierko, was offered the role of Chandler, but at the same time he'd received another offer for a part in a show called "Best Friends." Despite his desire to take on the role himself, Perry advised him to go with "Friends Like Us," but Bierko chose the other show, leaving his dream part still available.

A photo of Craig Bierko

Craig Bierko was originally offered the role of Chandler Bing. (Ron Galella/Ron Galella Collection)

Perry said that finally, a producer for NBC, the network that produced "Friends," asked her husband, a producer for the network behind "L.A.X. 2194," if the show would get picked up, wanting to know if Perry was available. The husband said it wouldn't – and it never did – and just days later Perry got a phone call for a meeting with a creator of the legendary show, Marta Kauffman.

He wrote about nailing multiple auditions until he was finally cast as Chandler.

LIKE WHAT YOU’RE READING? CLICK HERE FOR MORE ENTERTAINMENT NEWS

Claiming that the job "saved my life," Perry wrote, "I don’t know what would have happened to me had the call gone the other way. It is not out of the realms of possibility that I may have ended up on the streets of downtown LA shooting heroin in my arm until my untimely death."

Cast of "Friends" sitting in front of fountain

Perry was 24 years old when he was cast on the series. (NBC)

"Friends" fans will likely know that the cast was also close in real life – during the 2021 reunion on Max, Perry said, "The best way that I can describe it is after the show was over, at a party or any kind of social gathering, if one of us bumped into each other, that was it. That was the end of the night. You just sat with the person all night long and that was it."

CLICK HERE TO SIGN UP FOR THE ENTERTAINMENT NEWSLETTER

He added, "You apologized to the people you were with, but they had to understand you had met somebody special to you and you were going to talk to that person for the rest of the night. And that’s the way it worked."

Friends cast eats ice cream

"Friends" focused on the lives of six young adults living in Manhattan. (NBC)

Following the news of his death, Jennifer Aniston, Courteney Cox, Lisa Kudrow, Matt LeBlanc and David Schwimmer released a joint statement to People that read, "We are all so utterly devastated by the loss of Matthew. We were more than just cast mates. We are a family. There is so much to say, but right now we’re going to take a moment to grieve and process this unfathomable loss."

CLICK HERE TO GET THE FOX NEWS APP

"In time we will say more, as and when we are able. For now, our thoughts and our love are with Matty’s family, his friends, and everyone who loved him around the world."