You are mistaken in blaming v. This is actually a bug in unpack that was fixed in 5.10.0.
for ( [ 127, v4.127 ], [ 128, v4.128 ], [ 160, v4.160 ], [ 194, v4.194 ], ) { my ($x, $vstr) = @$_; # Workaround utf8::downgrade(my $vstr_dn = $vstr); printf( "got: %04X " . "workaround: %04X " . "expecting: 04%3\$02X or %3\$02X04\n", unpack('S', $vstr), unpack('S', $vstr_dn), $x, ); }

< 5.10.0:

got: 7F04 workaround: 7F04 expecting: 047F or 7F04 got: C204 workaround: 8004 expecting: 0480 or 8004 got: C204 workaround: A004 expecting: 04A0 or A004 got: C304 workaround: C204 expecting: 04C2 or C204

≥ 5.10.0:

got: 7F04 workaround: 7F04 expecting: 047F or 7F04 got: 8004 workaround: 8004 expecting: 0480 or 8004 got: A004 workaround: A004 expecting: 04A0 or A004 got: C204 workaround: C204 expecting: 04C2 or C204

Before 5.10.0, unpack used the internal buffer of its inputs with no regards to how the string was encoded within that buffer.


In reply to Re: v notation and IP addresses by ikegami
in thread v notation and IP addresses by cmac

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.