G'day, holandes777,

It looks like you've resolved this with ord.

I don't know how you intend to use 0x1c in your real code; however, I thought I'd just point out that it's special to Perl inasmuch as it's the default value for the subscript separator ($;).

$ perl -E 'say sprintf "%02x", ord $;' 1c

It was used in Perl4 (and earlier) to emulate multidimensional arrays. It's not needed for that purpose in Perl5: follow the link I provided for more on that.

As it's still part of the (Perl5) language, you should be aware of it; and avoid using it in a way such that it's interpreted as a subscript separator, which could result in a bug that's hard to track down. As an example, consider the following quick and dirty one-liner, which shows Data::Dump expanding the full key (e.g. 0\x1C0) but, when just printed, the (non-printable) 0x1c part is not displayed (e.g. 00).

$ perl -E 'use Data::Dump; my (%h, $x); for my $i (0,1) { for my $j (0 +,1) { $h{$i,$j} = $x++ } } dd \%h; say for sort keys %h' { "0\x1C0" => 0, "0\x1C1" => 1, "1\x1C0" => 2, "1\x1C1" => 3 } 00 01 10 11

— Ken


In reply to Re: concatenate a non-printable character onto an ascii string and inspect the content by kcott
in thread concatenate a non-printable character onto an ascii string and inspect the content by holandes777

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.