1
我希望得到一些帮助,以了解如何在perl中专门创建一个接收用户输入的文本文件。在perl中创建文本文件
print "\ndirectory has been changed";
print "\nDear user, please enter the name of the file you want to create ";
my $nameFile = <>;
open MYFILE, ">$nameFile" or die "couldn't open the file $!";
这将创建虽然不是一个文本文件的文件。
问候 阿里安
您不应该对错误进行解释(“我不认为这是一个文本文件”),您应该准确地指出错误。例如。 “它有一个不规则的文件名”或“当我尝试用vim打开文件时,它找不到它” – TLP