The Romans had to fight against the army of the Balkan king Pyrrhos.
This had a lot of war elephants.
The Romans had already suffered a few defeats against such pachyderms.
The weakness of elephants is that they are very easily scared.
The Romans took advantage of this. They rubbed the backs of pigs with an oily, flammable substance and set them on fire.
The pigs squealed in pain and thus ran toward the enemy elephants.
The elephants were so frightened that they turned back and raged through the ranks of their own army, trampling them underfoot.
Thus the Romans achieved victory.
By the way, the Romans were not the only ones who used pigs against elephants.
There was also a Persian ruler who hung a live pig on the city wall.
The enemy, besieging the city from the outside with elephants, fled because the elephants went crazy with fear.
Fortunately for the pigs, they were no longer used in war since the elephants went out of fashion.