use warnings; use strict; my @head = 'localhost'; open my $OUT_FH, '>', 'out.txt' or die "can not open out.txt: $!\n"; print $OUT_FH "@head\n"; close $OUT_FH; #### localhost