"So, tonight was awful, life changing and I'm only grateful to be alive," she captioned the tweet, followed by a picture of the lengthy story transcribed on her computer.
Perrette, 46, said the man "punched her in the nose, forehead repeatedly telling me he was going to kill me."
Perrette said the man kept repeating his name and threatening her life.
"I was alone, terrified and trapped," she continued, saying she then had the idea to let the man know her little nephew was also named William because "I knew I couldn't overcome him."
After striking the actress again, he told her to "get the f*** out of here."
She got away and then collapsed on the sidewalk. After calling the cops, she gave them a sketch of the man and he was arrested for felony battery.
LAPD confirm to ABC News that the call came in around 5 p.m. Thursday and that they caught the suspect. He was booked in downtown Los Angeles.
Perrette ended her detailed account by writing, "I am shaken and traumatized ... My life changed tonight ... I need to heal. I almost died tonight."