open FH,">file.txt" or die "Cann't open file: $!";
死不得不使用?如果我想要我的脚本继续(如果文件无法打开,只要忽略错误),该怎么办?
if(open my $fh,">","file.txt") { # do stuff with file close $fh; } else { # do stuff without file }