Large Language Models Can Learn Rules