Venture capitalist Marc Andreessen famously said that "software is eating the world," but this year it seems more like software is eating itself.

Software stocks have plunged in 2022 as multiple factors have combined to sink the sector: fears about a potential recession, lofty valuations, and a shift away from tech as the pandemic fades.

However, that plunge has created some appealing opportunities to buy -- valuations now look much more reasonable than they did a year ago, and revenue growth rates have largely held steady for most software-as-a-service (SaaS) stocks.

If you're looking to "buy on weakness," two software stocks that are primed to deliver long-term growth are Okta (OKTA 1.31%) and Salesforce (CRM 1.27%).

1. Okta: The leader in cloud identity

Okta's stock tumbled after its recent earnings report as the company acknowledged challenges integrating Auth0, the customer identity software business it acquired last year; the stock is now down roughly 80% from its peak last year. Okta also said it was reevaluating its long-term target of $4 billion in revenue by January 2026, and warned on macro headwinds.

However, a look at Okta's most recent earnings report shows its performance doesn't reflect the plunge in the stock price.

Revenue grew 43% to $452 million, beating estimates, and the company raised its guidance. While management said sales cycles were lengthening and remaining performance obligations grew more slowly, at 25%, the future still looks promising.

Okta, which provides software tools that allow employees and customers to log on seamlessly and securely and stay connected, said it has replaced the Auth0 salespeople it lost in the merger and is in the process of ramping them up. It's also changed its go-to-market strategy to make it easier for its salesforce and customers to understand which customer identity product -- Okta or Auth0 -- is right for them.

Margins are expected to improve, as the company said free cash flow would flip back to being positive in the third quarter and expand in the fourth quarter.

Finally, Okta is targeting an $80 billion addressable market; the company is on track to bring in less than $2 billion in revenue this year, leaving a long runway of growth ahead of it. The stock now trades at a price-to-sales ratio of less than 6, the cheapest it's been according to that metric since its 2017 initial public offering (IPO).

2. Salesforce: The cloud software pioneer

Arguably more than any other company, Salesforce has led the cloud software revolution. Investors have reaped the rewards, as the stock is up more than 3,000% since its 2004 IPO. Founded in 1999, the company is synonymous with customer relationship management (CRM) software, and it's still delivering strong growth.

Revenue rose 22% in its most recent quarter, or 26% in constant currency, to $7.72 billion. The adjusted operating margin was 20.4%.

Salesforce also just announced a new plan to increase profitability, responding to market demands for software stocks to deliver more on the bottom line. At its Dreamforce conference this week, the company outlined a plan to expand adjusted operating margins to 25%, in part by reducing spending on sales and marketing from 45% of revenue to 35% of revenue. It also said it would rein in share dilution to fund acquisitions, which comes shortly after it announced its first-ever share repurchase authorization, for $10 billion.

That renewed focus on cost discipline comes as the stock has fallen more than 50% from its peak last November. It now trades at a price-to-earnings ratio of 32 based on this year's expected adjusted earnings per share of $4.72.

In addition to growth through acquisitions, Salesforce also has opportunities for organic growth. These include new customers, especially small and medium-sized businesses, and the introduction of new products. At Dreamforce, Salesforce announced Genie, which it called a new data platform that enables the world's first real-time CRM.

While the company may not be able to deliver 20% annual revenue growth forever, it's done so every quarter for the last decade, and with the secular growth in the software sector remaining strong, its top line should continue to expand.