Getting your Trinity Audio player ready...

If S.J. Perelman had never existed, what would Woody Allen’s writing be like?

Beyond that metaphysical and unanswerable question, Allen’s first collection of pieces in more than 25 years should go a long way toward reclaiming the attention that his terrible movies of the past 10 years have done so much to dissipate.

Even if you’re a fervent reader of The New Yorker, there’s new material here — the first eight pieces in “Mere Anarchy” (Random House, 192 pages, $21.95) have never been published.

The new collection also serves as a referendum on Perelman, the single biggest influence on Allen’s humor writing, as opposed to his films and their slightly dour, social realist mood, which is largely absent from his more or less purely antic and absurd writing.

Like Perelman, the inspirations for the new collection are primarily genre parody, often the identical genres that Perelman took on 50 and 60 years ago:

Chandleresque noir, police procedurals, or the conflation of high-brow intellect and low-end culture, as in the Friedrich Nietzsche diet book: “Fat itself is a substance or essence of a substance or mode of that essence. The big problem sets in when it accumulates on your hips.”

If anybody still thinks Dennis Miller’s references are hip, they should check out Allen: “Down at headquarters, I chatted with Ben Rogers, my mentor and the man who solved the Yuppie Restaurant Murder Case, where the victims were shot and then lightly dusted with lime and fresh mint.”

For writing like this, rhythm is critical, as is the snapper at the end of the sentence: “Just yesterday, after finally filching some measure of lebensraum, I was about to consummate the sacred act of love with my one and only profiterole when your workers picked me up and moved me so they could hang a sconce.”

Writing this artificial is the literary equivalent of French farce — devilishly difficult to construct but exhilarating when you pull it off, painful when you can’t.

Allen’s comic writing can be taken as an extended homage, or a craven imitation, but he does it very well.

The truly odd thing about this dense layering is that it takes so much time to get right; one or two words can make the difference between flatulence and fulfillment, and in his day job, Allen has been making movies that feel dashed off, as if he’s shooting first drafts and can’t be bothered to polish. Sometimes, the premise is good (“Small Time Crooks,” “Hollywood Ending”), but the premise is all there is. Where are the jokes?

These pieces are every bit as trivial as the movies Allen has been making, but their nimble delight in wordplay redeems them in a way that nothing in the movies can.

There are occasional tinny one-liners that even Henny Youngman would have passed on, but the pieces are all polished. And for every hollow line begging for a rimshot, there’s one that recalls the matchless spiraling madness of Groucho Marx, for whom, it should be pointed out, S.J. Perelman used to write: “It wasn’t long before Stubbs and Doxy Nash began having a secret affair, although soon she found out about it.”