open( my $fh, '>', 'fruit.out' ) or die $!;
print $fh $_ for @output;
记得给好评哦亲O(∩_∩)O~
@output = qw/apple pear cherry/; # 你给出的那个写法是不对的.
open F, ">fruit.txt" or die "$! Can't create file";
print F $_.$/ foreach @output;
close F;
#从头开始写
open(FILE,">fruit.txt");
#文件结尾追加
open(FILE,">>fruit.txt");
print FILE "@arr";