Well it isn't the most pretty thing, but this will at least let you avoid specifying the number of values in more than one location:

(broken, see update)

my $header_format = 's'x50 . 'c'x150; read FILE, $line, length $header_format; my @header = unpack( $header_format, $line );
As for the documentation inconsistency, I'd bet its just a document error, as I've found file formats among the worst parts of documentation, which is often poor to begin with. The authors often don't expect many people to use these parts, so they don't get edited or updated properly. I would fire off an e-mail to the authors on the point though.

Hmm... if you use the 'a' template in place of the 'c' then I think you can avoid the map and chr in your join.

Update: Argh, posted too fast! This is broken... the length of the $header_format will only be the read length if we're dealing with 1-byte templates, and we aren't... oops!

--
I'd like to be able to assign to an luser


In reply to Re: read() and unpacking, data size issues by Albannach
in thread read() and unpacking, data size issues by Masem

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.