dasgar points out what seems likely to be your most immediate problem.

In addition, you don't define the structure of your data records, but if the 'record length' field is anything other than four decimal digits (in particular, if it's a raw, four-byte integer of some kind), you may have a problem down the road with record lengths that work out to be something unexpected, especially zero. (However, you do have warnings turned on, which could alert you if some of these problems arise.)

Here are some examples of the handling of various four-digit strings. The '0123' string is intended to represent something that some humans and computers might be tempted to interpret as an octal number. The  qq{\x00\x00\x00\x08} represents a 32-bit, raw binary, big-endian 8.

>perl -wMstrict -le "print qq{'$_' -> }, 0 + $_ for '1234', '12AB', 'AB12', '0123', qq{\x00\x00\x00\x08}; " '1234' -> 1234 Argument "12AB" isn't numeric in addition (+) at -e line 1. '12AB' -> 12 Argument "AB12" isn't numeric in addition (+) at -e line 1. 'AB12' -> 0 '0123' -> 123 Argument "\0\0\0^H" isn't numeric in addition (+) at -e line 1. ' ' -> 0

In reply to Re: Can someone tell me why this hangs?? by AnomalousMonk
in thread Can someone tell me why this hangs?? by monty77

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.