Carl,
Have you tried to use the globbing function rather than readdir?
my $file;
while(<*.txt>){
$file=$_; # not strictly needed, I know, but makes it clear
open(F,$file) || die "with a nice error message\n$!\n";
while(<F>){
# do something useful with the file
}
close F;
}
Mike Lacey
www.tek-tips.com -- a friendly, flame free, environment for computer
professionals and students
Perl forum at:
http://www.tek-tips.com/gthreadminder.cfm/lev2/4/lev3/32/pid/219
----- Original Message -----
From: "Carl Rogers" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 08, 2001 5:42 PM
Subject: Perl and WindowsNT
> Sorry if this is a dumb question.. (I know, there is no such thing as a
> dumb question- only questions asked by dumb people:)
>
> I used the opendir() function in my Perl script to point to a folder with
> 200+ text files for the purpose of extracting data from each file.
>
> If I run the script with opendir/readdir pointing to a directory on a
> shared drive, I'll get to a point where Perl tells me "Can't open file- no
> such file or directory"
>
> If I copy the "bad" file to my home directory, run the same script with
> opendir/readdir pointing to my home directory now- it can be opened and
read.
>
> The weird part: If I go back and opendir/readdir to the shared directory,
> the "bad" file is all of a sudden working and another file later in the
> directory becomes the "bad" file. As the steps are repeated, more files in
> the shared directory are able to be read.
>
> Question: Is there a "feature" in WindowsNT that would cause Perl to
behave
> this way? I've tried by changing the properties on the files, and that
> doesn't seem to help. (BTW: I'm using Perl 5.001running on NT 4.0 SP 6)
>
> I'm hoping there is a more efficient way of solving this "hiccup".
>
> Thank you in advance for all of your time & help.
> Carl
>