Your errors come from :
$fh=$headers;
print "$fh\n";
and
$fh=join('\t',@riteline);
print "$fh\n";
You’ d write:
print $fh $headers,"\n";
and
print $fh join("\t",@riteline),"\n";
for the last one I think you want:
print $fh @riteline,"\n";
Also, don’t use @DAY[$ii]
but $DAY[$ii]
4
solved My code to write a .txt file from my @data isn’t working :(. What am I doing wrong? I am using a while loop