I think the problem in your script is your print line. You have:
print $in, "\n" ;#"$hu,$hd,$lt\n"
which I'm assuming you were originally trying to print what is in comments.
What you would really want is:
print $in "$hu,$hd,$lt\n"; # no comma between $in and "..."
Other important things:
- Check errors after everything (chdir, open, opendir, close). If that doesn't work, you can even make sure print completed successfully.
- You should make more use of string interpolation. It would make your code cleaner. That is, use open my $in, ">>$seq_dir/$fa" instead.
- It's generally considered better form to use the three argument version of open, so change your open lines to open my $in, ">>", "$seq_dir/$fa"; and similar.