Jimmy Perry, who has died aged 93, created and co-wrote, with David Croft, the BBC situation comedy Dad's Army, which he based on his wartime experiences in the Home Guard, and which became one of the most popular and best-loved shows on television.
Throughout the 1970s and '80s he also collaborated with Croft on other popular sitcoms including It Ain't Half Hot Mum, Hi-de-Hi! and You Rang, M'Lord?
Perry, the extrovert of the pair, invariably drew on personal experience: having served in the Home Guard as a teenager, he joined the wartime regular army, was posted to Burma with the Royal Artillery and joined his unit's concert party, which inspired It Ain't Half Hot Mum.
Demobbed, he trained as an actor and spent his holidays working as a Butlin's Redcoat, stints that later yielded material for Hi-de-Hi! (1980-1988) which, after a slow start, caught on, to the dismay of Butlins, who had spent 20 years trying to bury their end-of-the-pier image. Curiously, though, Fred Pontin, Britain's other holiday camp king, loved the show.
For more than a quarter of a century, Perry worked in what he called the "middle-class, rather snobbish environment" of the BBC. "I'm ashamed to admit it," he remarked in his memoirs, "but it suited me down to the ground." The Perry-Croft formula included an ensemble cast, a fixed setting, a range of characters of all ages, types and classes, an unflinching portrayal of human frailty and – above all – a genuine affection for their subjects.
The partnership dominated the BBC's prime-time comedy schedules for 20 years, a feat unmatched by any other scriptwriting team.
Perry had the idea for Dad's Army while travelling on a suburban London train, wrote a one-off script, and in 1966, while appearing in an episode of Beggar My Neighbour as an actor, showed it to the producer, David Croft, who pitched it to BBC management.
Reaction at Television Centre was initially hostile, with grave reservations being expressed about satirising Britain's Finest Hour, and at least one department head calling it "absolutely mad", but eventually Perry and Croft won the argument. Casting the series in 1967, Perry struggled to persuade the BBC's head of comedy, Michael Mills, to give the part of Captain Mainwaring to Arthur Lowe, then a regular in ITV's Coronation Street. Eventually Mills agreed, and also came up with the series title Dad's Army – which Perry had to confess was a huge improvement on his original one, The Fighting Tigers.
Perry and Croft wrote the scripts together, one with a pencil writing it down, the other pacing the room. Halfway through a scene, the pencil was passed from one to the other. Rehearsals were fraught; the actor John Le Mesurier (playing the languid Sergeant Wilson) declared that the new show was a shambles. "It's absolutely appalling, it can't possibly work," he told Barry Took. "No, no, my dear boy, it's an absolute disaster."
But when the program made its debut in July 1968, 7 million viewers tuned in, and the critics loved it. In London's Sunday Telegraph, Philip Purser thought Perry and Croft's characterisations had been "maturing over a dozen years and in some of the greatest cellars in comedy". By late 1972 more than 16 million were watching. The show ran to 64 episodes and became a mainstay of the BBC schedules for nine years; thanks to countless repeats, it has long since become a classic.
Perry's famous "Don't tell him, Pike!" scene was repeatedly voted the funniest in television history, and in several polls the series ranked as Britain's favourite comedy. "Of all the cultural success stories of the late 1960s," noted the historian Dominic Sandbrook, "Dad's Army was not only one of the most unexpected, but one of the most enduring."
James Perry was born in 1923 at Barnes, south-west London, into a prosperous middle-class family; his father, who ran an antiques shop at South Kensington, was a founder of the British Antique Dealers' Association.
His happy childhood teemed with characters and catchphrases he would later incorporate into his scripts: his father, for one, balefully noting his son's early passion for the entertainment world, would chide him with "you stupid boy", a phrase that became Captain Mainwaring's admonition to Private Pike in Dad's Army. Perry based Pike's character on himself as a teenage mummy's boy, noting that although his own mother never made him actually wear a scarf, "she came pretty near".
Young Jimmy's grandfather – who had attended the last public execution in Britain – had been a butler at a grand house in Belgrave Square, and his stories were the basis of You Rang, M'Lord? (1988-93). The Perry family's daily woman, Mabel, was the model for the charlady in the same show.
After leaving St Paul's School aged 14, Jimmy was sent to secretarial college, but having truanted for the whole of one summer, reading Tarzan books on Barnes Common instead of attending classes, he became apprenticed in the carpet department of Waring and Gillow's in Oxford Street. The outbreak of war put paid to his career as a salesman, however, and his family moved to live above his uncle's antiques shop at Watford.
It was there that Perry served in the Home Guard, joining the Watford company of the Bedfordshire and Hertfordshire Regiment. Among the motley recruits was the original Lance Corporal Jones, an elderly French polisher (rather than a butcher, as in Dad's Army) who had served in the Battle of Omdurman in 1898. When a local professional comedian saw Perry telling jokes on stage at the Gaumont Cinema, he invited him to join a concert party.
Although, at his mother's insistence, Perry delayed his conscription by working at a munitions factory, in late 1943 he was called up and joined the First (Mixed) Heavy Anti-Aircraft Regiment of the Royal Artillery at Oswestry. His success as a member of the camp concert party meant that the regimental colonel kept him away from the D-Day landings, but later in 1944, after an altercation with a captain at the base, Perry was posted to the Far East and sent first to Bombay and then on to Burma, being promoted en route from gunner to bombardier.
He eventually found himself in the concert party attached to the Royal Artillery base in the famed former mental hospital at Deolali. His time there, and a subsequent stint with Combined Services Entertainment – under the gimlet eye of a regimental sergeant-major who regarded the entire troupe as "a bunch of poofs" – later inspired It Ain't Half Hot Mum (1974-81).
Although now considered politically incorrect, with its portrayal of Indian "natives" and guying of gays, Perry and Croft considered this the funniest of their collaborations.
When, on his return to England, Perry failed to get a booking at the Windmill Theatre, in 1947 he enrolled at Rada with Warren Mitchell, Lionel Jeffries and Dorothy Tutin, also taking summer jobs as a Redcoat at Butlin's at Pwllheli, north Wales, the inspiration for Hi-de-Hi!
Having turned down the offer of a permanent job from Billy Butlin in person, from 1950 Perry worked as an actor in weekly rep and in West End musicals. In the early 1960s he returned to Watford as actor-manager at the town's repertory theatre, where he became a familiar figure in heavy checked tweeds, Inverness cape and deerstalker hat. When he joined Joan Littlewood's Theatre Workshop at Stratford, east London, Perry found himself thinking about developing a television sitcom and remembered his experiences in the Home Guard.
Working apart from Croft, Perry had less success, with two ITV sitcoms, Room Service (1979) – about hotels – and High Street Blues (1989) – about supermarkets – proving instant flops, both arguably contending for the title of worst British sitcom ever.
He composed the signature tunes of all his hit comedy series, most notably that of Dad's Army, for which he wrote Who Do You Think You Are Kidding, Mr Hitler? Sung by Bud Flanagan, it won the Ivor Novello award for best television signature tune in 1971.
With David Croft, Perry received the Writers' Guild of Great Britain award for best comedy script for three consecutive years between 1969 and 1971, and won a Bafta award for best television episode in 1971 for Dad's Army. He won the guild's lifetime achievement award in 1995 and the Comic Heritage Award in 1998.
Perry was appointed OBE in 1978. His autobiography, A Stupid Boy, appeared in 2002. In 1990 he was diagnosed with bowel cancer, but given the all clear after surgery. David Croft died in September 2011 aged 89.
In 1953 Jimmy Perry married the actress Gilda Neeltje. He is survived by his partner, the costume designer Mary Husband.