I'd like to split a "text" file based on an unprintable record delimiter: \x0a. The input file is basically like this:
\x0a Record stuff goes here more of the same record here yet more record data. \x0a Next record starts here and continues on for a while and finally terminates. \x0a You get the idea. Please note that \x0a is a one-character ASCII code, not the string of characters '\x0a'. \x0a I probably can't rely on indents for record boundary checking, either.

--- Code snippet begins ---
use strict; # I'm not a total neanderthal $/ = /\x0a/; # also tried '\x0a' open IN, shift; my @records = <IN>; close IN; # number of records == 1 (globbed!)
I suspect that my $/ = /\x0a/ and $/ = '\x0a' fails because \x0a isn't text, right? Must I do an unpack(), or am I overlooking something?

Thanks,
rje

In reply to Splitting on unprintables by rje

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.