Alright, I'm relatively new to perl, and I think this is a pretty simple question, but for some reason my code outputs nothing. I just want to open a directory, read the filenames of all the files in it, and output that array to a file. When I run the code I just get a .txt file with nothing it in.
opendir(DIR, "C:\AATv2");
my @files = readdir(DIR);
closedir(DIR);
open(OUT, ">environments.txt");
foreach $f (@files){
print OUT "$f\n";
}
close(out);
Thanks in advance. I'm also unsure why I can't put any newlines in my code. Sorry I'm a n00b at this website too.