我刚开始学习 Perl,但在打开与我的程序位于同一目录中的文件时遇到了问题。
#!/usr/bin/perl -w
$proteinfilename = 'NM_021964fragment.pep';
open(PROTEINFILE, $proteinfilename) or die "Can't write to file '$proteinfilename' [$!]\n";
$protein = <PROTEINFILE>;
close(PROTEINFILE);
print "Essa é a sequência da proteína:\n";
print $protein, "\n";
exit;
当我指定文件的目录时,从“NM_021964fragment.pep”更改为“/Users/me/Desktop/programa/NM_021964fragment.pep”,程序运行。但是,即使没有我指定目录,它也不能工作,因为程序和文件在同一个文件夹中?