There are two important phrases to note in this question. One is “for firms” and the other is “in the long run.” These two phrases shape the answer to this question.
In the short run, it is possible for firms in perfect competition to incur losses. In the long run, however, it is not possible for all the firms (this is why it is important that the question is about “firms” and not “a firm”) in a perfectly competitive market to incur losses. The reason for this is that, in the long run, firms will leave the industry if they are making losses.
In perfect competition, it is easy for firms to enter and leave the market. If firms are losing money and cannot find ways to stop their losses, they will simply leave the market. When this happens, supply will fall. The supply curve will move up and to the left and a new equilibrium will be reached at a higher price (and a lower quantity produced). At that point, there will be no more losses.
In the long run, then, the firms in a perfectly competitive market will see their losses vanish because some firms will leave the market, causing a decrease in supply and an increase in prices.