FIVE years ago Tom Perkins, one of Silicon Valley's most successful investors, wrote a novel. “Sex and the Single Zillionaire” tells the story of a single zillionaire who accepts an invitation to appear on a reality-TV show, “Trophy Bride”, and is then confronted by a lot of sex (“Heather was nude upon the bed and Kim, above her, was also nude, but wearing some sort of complicated black leather harness…”). Rupert Murdoch, whose company HarperCollins published the book, pronounced it “a great read”. A more objective Amazon reviewer described it as “an argument in favour of book-burning”.

The plot of “Sex and the Single Zillionaire” is only slightly more improbable than the recent history of Hewlett-Packard (HP), a company for which Mr Perkins worked in the 1960s and on whose board he sat when he was writing his bonkbuster. For its first 60 years HP exemplified all that is admirable about Silicon Valley. It was a scrappy start-up that grew into a high-tech powerhouse thanks to relentless innovation and solid management principles (“the HP way”). But then things started to go wrong.

The company has lost six chief executives since 1999. Carly Fiorina was dumped in 2005 after HP's share price halved; Mark Hurd in 2010, after a sex-and-expenses scandal. In 2005-06 the company was caught spying on board members, its own staff and the press in a doomed attempt to plug leaks. Mr Perkins, who resigned from the board over the spying scandal, told the New York Times that: “I didn't know that there was such a thing as corporate suicide, but now we know that there is.” On September 22nd HP's board sacked Léo Apotheker, Mr Hurd's successor, after 11 months in office. A day later it appointed Meg Whitman, the former boss of eBay, an online-auction site, to replace him.

The tech world has endlessly debated what went wrong with HP. Is it just the passage of time? It is hard to reach old age in Silicon Valley: your technology goes stale, and young bruisers such as Google and Apple kick away your zimmer frame. Or is it HP's dysfunctional board (which the eloquent Mr Perkins describes as “the worst board in the history of business”)? Apparently, HP hired Mr Apotheker without his ever meeting the full board.

Perhaps. But a resurgent IBM has just celebrated its 100th birthday, and the HP board has been remade several times in the past decade. There is a third possibility: that HP has fallen victim to the cult of the corporate saviour. It keeps reaching outside its ranks to hire a superstar as CEO. This is something HP never did during its glory days. And it never seems to work.

On the face of it, scouring the world for a superstar makes perfect sense. Surely a great manager can make all the difference to an ailing firm? Jack Welch boosted General Electric's market capitalisation by 4,500% at a time when its old rival, Westinghouse, was disintegrating. Surely management skills are portable? What other justification is there for the giant MBA and executive-education businesses? And surely it is sensible to cast your net as widely as possible in search of the world's fizziest talent? In the 1970s only about 15% of all CEO vacancies in Forbes 1,000 firms were filled by outsiders. By the early 2000s the share had climbed to 33%. It is even higher in the high-tech industry.

Companies can point to one strong piece of evidence in favour of hiring outsiders: share prices usually leap at the news. But a gathering pile of academic studies points to the opposite conclusion. Jim Collins, the author of “Good to Great”, insists that great companies almost always recruit CEOs from within. Rakesh Khurana of Harvard Business School argues that looking outside for a “corporate saviour” erodes the morale of the talent within. An unpublished paper presented to the annual conference of the American Accounting Association in August by Richard Cazier of Texas Christian University and John McInnis of the University of Texas at Austin brings a new level of rigour to the debate.

Messrs Cazier and McInnis studied 192 CEOs who had been brought in from outside between 1993 and 2005. They discovered that companies usually recruit CEOs from companies that have done well in the past—no surprise there—and that they usually pay them a fat premium. But then comes the rub: the pay premium is negatively correlated with the future performance of the firm that does the hiring. In other words: the more dazzling the outside recruit, the worse he performs in his new role.

Corporate culture matters more than stars

This may be because superstars have an inflated opinion of their own abilities. They assume all the credit for the success of their previous firm, when in fact many others were involved. And they imagine that they can transform a corporate culture single-handed. Usually, they can't. The authors observe that the tendency to hire CEOs who have done well elsewhere is most common among firms “with busy and inattentive boards”.

Some outside hires succeed. Lou Gerstner revived IBM despite being a high-tech outsider (he was previously at McKinsey and American Express). But HP is surely tempting fate by appointing a fourth outside CEO (or near-outsider, given that she has spent a few months on the board).

Ms Whitman is also a superstar, which does not bode well. She made a fortune by taking eBay public. But she flagged badly as the company grew into a mature business—ie, as it became more like HP. She also failed when she tried to translate her corporate fame into a political career. In 2010 she ran for the governorship of California. (As it happens, she stood shoulder to padded Republican shoulder with Ms Fiorina, who was running for the Senate.) Both lost miserably, despite a pro-Republican tide. Ms Whitman spent $100m of her own money and still lost by 13 points against an eccentric bald guy. Something tells us that the HP story has more unsettling chapters still to come.

Economist.com/blogs/schumpeter