Luke Perry played Fred Andrews in CW's "Riverdale."
CNN  — 

CW’s “Riverdale” has recruited a special guest to help the show pay tribute to late cast member Luke Perry in its upcoming season premiere.

Shannen Doherty, who co-starred with Perry on “Beverly Hills, 90210,” will appear in the episode titled “Chapter Fifty-Eight: In Memoriam,” a one-hour episode that will reflect Perry’s “enduring legacy and the indelible imprint his character, Fred Andrews, had on ‘Riverdale,’” a press release stated.

The casting was announced during the show’s panel at San Diego Comic-Con.

“I am deeply honored to pay tribute to Luke on Riverdale,” Doherty wrote on instagram. “The care in which this show takes in honoring his memory is beautiful. He is missed. Today. Tomorrow. Forever.”

Perry died in March after suffering a stroke. He was 52.

Showrunner Roberto Aguirre-Sacasa had said last month the season premiere would be dedicated to saying goodbye to Perry, who appeared on the show since 2017.

In a statement, Aguirre-Sacasa said Perry had wanted Doherty to guest since season 1 of the show.

“They were such good friends, and when we were putting together this tribute episode, we wanted to make it as special as possible, and so we asked Shannen to do a pivotal, super-emotional role,” he said. “She read the script and immediately said ‘yes.’ It’s very impactful.”

“Riverdale” returns to CW on October 9, 2019.