in reply to How to open file inside loops with file names generated using an array?

If you are opening a bunch of files, it is a good idea to include the bad filename into the error message, like this:
foreach my $dat1 (@data1){ foreach my $dat2 (@data2){ my $path = "file_$dat1\_$dat2.txt"; open (FH, "<", $path) or die "Error opening '$path': '$!'"; .....do something...... } }
  • Comment on Re: How to open file inside loops with file names generated using an array?
  • Download Code