read() and IO:File->read() error

M

Mark H. Siffer

I have a file I am reading and when I get to a certain point read() and
IO::File->read() return undef. I know I have not reached EOF. Is there
anywhere I can find out why it can't read() or trap an error?

Thanks in advance
MS
 
U

Uri Guttman

MHS> I have a file I am reading and when I get to a certain point read() and
MHS> IO::File->read() return undef. I know I have not reached EOF. Is there
MHS> anywhere I can find out why it can't read() or trap an error?

how do you know (better than read()) that you have not reached EOF?

and actually if you rtfm carefully, EOF is marked with a 0 return, undef
means an error. so if you really get undef (check with defined) print $!
and see what the error is.

uri
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top