I have a bunch of files in a folder.
file_1.1_2.1.txt, file_1.2_2.2.txt and so on.
I am reading those files and extracting the info from the file name file_<data1>_<data2>.txt. After getting the info it is assigned to array @data1 and @data2 . I only require files in this format, there are also other files which i dont need. I am trying open the files using foreach.
foreach my $dat1 (@data1){
foreach my $dat2 (@data2){
open (FH, "<", "file_$dat1\_$dat2.txt") or die "a horrible death $!
+";
.....do something......
}
}
If I run this I am getting error "No such file or directory."
but running it outside the loop works. For Example.
open (FH, "<", "file_1.1_2.1.txt") or die "a horrible death $!";