We don't bite newbies here... much | |
PerlMonks |
seek function always returns trueby rudyg123 (Initiate) |
on Jun 19, 2007 at 22:03 UTC ( [id://622118]=perlquestion: print w/replies, xml ) | Need Help?? |
rudyg123 has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I'm very new to Perl programming so please excuse me if this problem I'm having sounds basic.
I am writing a script to parse a binary file. The file contains hex data that is formatted in such a way that I can jump anywhere in the file to read data.
The program prompts the user for input asking which record in the file to read. There is a possibility that the record is not contained in the file. This can happen if the file is too small (not enough records to satisfy the input parameter request).
The following code is executed and my problem is that the die is never executed. The seek is always returning a 1. I have run test cases where I know the record I am asking for is greater than the contents of the file. In other words the offset in bytes from the beginning of the file is greater than the number of bytes in the file. Why doesn't the seek return 0.
Back to
Seekers of Perl Wisdom
|
|