in reply to Re: Re: list of fles in a directory, but use wildcards like *
in thread list of fles in a directory, but use wildcards like *

foreach $file (@file){ open(MYFILE, $dir.$file[$i]) or die qq(Cannot open $file[$i]\n); ...
Well, in addition to the previous comment about the directory path (which is correct), this snippet would not do what you want because you aren't setting $i; you are using the scalar $file as an iterator variable, which is being set to successive elements of array @file, but then in the loop you are always using the "$i'th" element of @file, and you don't show any indication that this (totally unnecessary) array index counter is being set or incremented.

On top of that, your error report is misleading: you try to open a file called  $dir.$file[$i] and when that fails, you only report trying to open  $file[$i], so you would never know when the problem is due to the content of $dir.