in reply to Opening files in NT

In addition to the good things Corion mentioned about always checking for errors when you make system calls and explicitly specifying "<" when opening files (even when you don't have to), I noticed a couple of other things.

Because $line is a scalar variable, you are reading the file in line by line. Thus the first line is read in at the first instance of
$line=<FILE>
then the second line, and subsequent lines, are read in during the while() loop. With your code, the first line won't be printed. That may or may not be what you wanted.

Finally, you'll probably need a carriage return and/or a line feed, so your print line should probably read something like
print "$line\n\r";
Again, this may or may not be what you want, but my experience with NT tells me the addition of a CR and/or LF often makes a difference.

Replies are listed 'Best First'.
Re: Re: Opening files in NT
by premchai21 (Curate) on Mar 21, 2001 at 01:14 UTC
    Actually, because $line hasn't been chomped, the newline will remain intact.