Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

End Of File

Status
Not open for further replies.

mark1110

Programmer
Apr 20, 2005
85
US
I am very new to PERL. I need to modify some existing code:

unless(open (OVERAPPOINTMENTFIL, ">>$fileName"))
{
&LogMsg ("E","Can\'t open file $fileName.");
return $FALSE;
}


unless (printf OVERAPPOINTMENTFIL (
$overappointmentfil{tin},
$overappointmentfil{state},
$overappointmentfil{company_cd},
$overappointmentfil{appt_dt},
$overappointmentfil{created_dt},
$overappointmentfil{created_userid},
$overappointmentfil{last_updated_dt},
$overappointmentfil{last_updated_userid}
))
{
&LogMsg ("E","Can\'t write to file $fileName.");
return $FALSE;
}

I want to put an end of file condition but when I use it after the last } I get an error message. Here is the statement I am using:

if (eof($overappointmentfil)) {
print "END OF FILE";
}

Can anyone tell me what I am doing wrong?


Thanks,

Mark
 
[tt]eof()[/tt] is only useful in reading files, whilst you are appending to the file. You are necessarily at end of file there, so can't see what you want to do.
Also: the correct way of using [tt]eof()[/tt] is
[tt]eof(OVERAPPOINTMENTFIL)[/tt] or just [tt]eof[/tt], as it will use the last file read.

Franco
: Online engineering calculations
: Magnetic brakes for fun rides
: Air bearing pads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top