Whales can learn about danger and can warn each other, according to a study of how they dodged whaling ships in the 19th century