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