Quote:
Originally Posted by Perl Beginner
Well, there not much code to post. i have a directory that has more than one file in it and i would like to just pick the first one. My code saves files into the $destination_dir folder and from this directory i want to select the first one without using the file name.
For example, the directory itself would have the file names
test_results0001.txt
test_results0002.txt
test_results0003.txt
once i unlink the test_results0001.txt then the 0002 is now the first one.
test_results0002.txt
test_results0003.txt
when i'm done with that one, i will unlink it and move to the next one. but i don't know how to grab it to use it. so you can see why i can't go by the file name.
[HTML]
$destination_dir = C:\\Test Data\\Test_Results\\";
.
.
.
@result_files = <'$destination_dir\\ '>; #this is where i don't know how to call it
foreach $file (@result_files)
{open (RESULT, "<$file") or die "and error occurred: $!";}[/HTML]
Ok, let me see if I understand this. You have a directory that has "x" number of files in it. You want to get a list of the files in that directory an delete them, regardless of the file name? Is that correct? It looks like you want to open each file, individually and do something with the contents and then delete it.
Can you just clarify for me?
As for the line above you "don't know how to call it", is that the line you are getting the list of files and plugging them into an array?
Regards,
Jeff