If you’re a hungry caterpillar and you’ve got a choice between eating a plant or another caterpillar, which do you chose?

You pick your fellow caterpillar, scientists have found — if the plant is noxious enough.

In a study published Monday in Nature Ecology and Evolution, scientists sprayed tomato plants with a substance that induces a defensive response — a suite of nasty chemicals — and found that caterpillars became cannibals instead of eating the plant.

“The plant rearranges the menu for the caterpillar and makes other caterpillars the optimal choice,” said John Orrock, an evolutionary ecologist at the University of Wisconsin — Madison who led the study.

His team’s findings support a growing body of research suggesting that plant defenses are far more sophisticated than we’ve thought. Plants can’t run or hide, but they possess powerful strategies capable of altering the minds of herbivores that try to eat them.