in reply to Re: Re: Reading from a file on a NT server
in thread Reading from a file on a NT server
Ok, a few comments:
- Asking for help with code and then giving people different code probably isn't going to help uncover problems with the actual code. If you're not going to submit the actual code, pare the actual code down until you have the smallest chunk that exhibits the problem you're seeing.
-
Checking for the existance of a file and then opening it creates a race condition. Not as much of a problem in this case, but it's a well known way to introduce bugs (or worse, security problems). Just open the file, and if it fails and you really want to know why check if $! was POSIX::ENOENT
-
The usual idiom is open(...) or die "Can't open foo: $!\n"; you're possibly betraying a C heritage, but remember Perl isn't C.
-
$#array is the index of the last element, not the size. You mean print "Size: ", scalar @inFile, "\n"
-
Putting ""'s around a single scalar variable (e.g. "$SaleFile") is pretty much useless (except in the case where the scalar contains a blessed object with a custom stringification routine, but that's not the case here).