Jarrod,
Where do you open the directory that you attempt to read? Note the following code:
next unless ( open(FIL, "$file")); # This statement does not read a line, it just
opens the file.
$sRecp = <FIL>; # Why do you do this? Do you always want to skip the first line of
the file?
while (<FIL>) {print;} # This while statement will read the file one line at a time
and assign the contents of the line to $_,
print with no args will default to using $_.
chomp($sRecp); # Are you using this value for something later in the program?
close(FIL);
}
closedir(DIRHND);
Dirk Bremer - Systems Programmer II - AMS Department - NISC
636-922-9158 ext. 652 fax 636-447-4471
<mailto:[EMAIL PROTECTED]>
----- Original Message -----
From: "Jarrod Ramsey" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 10, 2001 5:22 PM
Subject: File I/O Question
> This is a pain for me to deal with, maybe its my method or the way I'm
> reading the file, but when I open a file, it reads only every 4th line. The
> way I thought it was set up, it should only read one line at a time. Please
> look at the code below and help me out if you can.
>
> I've tried it several ways, and this one happens to be the last one I tried.
> Any help would be useful.
>
> ( my(@allFiles) = readdir(DIRHND) ) || ( LogEntry(statslog, "Couldn\'t read
> $userpts: $!") );
> foreach $file (@allFiles) {
> my($sBody); my($a);
> $file = "$userpts\\$file";
> print "$file\n";
> next unless ( open(FIL, "$file")); ## I watched the code execute
> and this statement actually gets the first line.
> $sRecp = <FIL>; ## whereas this one gets the
> second line.
> while (<FIL>) { ## this one the third
> $sBody .= <FIL>; ## this one the
> fourth
> }
> print $sBody;
> chomp($sRecp);
> close(FIL);
> }
> closedir(DIRHND);
>
> Thanks
> -jr
>
>
> **********************************************************************
> This email and any files transmitted with it are confidential
> and intended solely for the individual or entity to
> whom they are addressed. If you have received this email
> in error destroy it immediately.
> **********************************************************************
> _______________________________________________
> Perl-Win32-Admin mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin
>
>
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin