Hi Monks, I'm reading what apparently is a binary file -I can view it in emacs and along with valid alpha-numeric characters there are also plenty of unprintable/unreadable characters and spaces (the spaces appear as \x20 when the hexl-mode option is turned on in emacs). When I read this file using Perl I don't want to loose those spaces as they are important in determining field lengths. How do suggest I go about doing this - currently I seem to be dropping those spaces? Thanks.... Ok, here goes - My file, when opened in emacs, looks like this: EWH12345^A%^D 704_Barrington_Ctr Warrington_Pa DAH45678^A^%^D 705_Barrington_Ctr Warminster_Pa When I turn on hexl-mode, the "^A%^D" above is "012504", but the spaces are, as you would guess, a hex 20. My question is, the best way to read something like this and not loose those spaces - thanks!

In reply to keeping spaces by Spooky

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.