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.
seek(FIN, $start_pc, 0) or die "seek:$!";

In reply to seek function always returns true by rudyg123

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.