大多数时候,我做这样的事情:
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 }