An elephant’s trunk inspired scientists to invent a tool that can do many of the same things.