下面是输出到文件的例子代码,希望对你有所帮助:open(FD,">test.txt");print FD, "输出内容到文件的测试.");close(FD);这段代码执行后会建立test.txt文件,内容就是我们print的.