For those of you who are too lazy to run pg's code, here's the output ;-)
========================= Case 1: create string from pack, with use bytes char semantics: ÆÄ² Length = 4, Content = 198.144.196.178 byte semantics: ÆÄ² Length = 4, Content = 198.144.196.178 400.306 ========================= Case 2: create string from pack, with use utf8 char semantics: ÆÄ² Length = 4, Content = 198.144.196.178 byte semantics: ÆÄ² Length = 4, Content = 198.144.196.178 400.306 ========================= Case 3: create string from \x{} char semantics: ÆÄ² Length = 2, Content = 400.306 byte semantics: ÆÄ² Length = 4, Content = 198.144.196.178 400.306

Update I'm on perl 5.6.0 on solaris, so it's probably my own problem ;-). Full spec:

> perl -V Summary of my perl5 (revision 5.0 version 6 subversion 0) configuratio +n: Platform: osname=solaris, osvers=2.6, archname=sun4-solaris uname='sunos fluidy 5.6 generic_105181-23 sun4d sparc sunw,sparcse +rver-1000 ' config_args='-Dcc=gcc -Dprefix=/opt/local/gnu' hint=previous, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultipl +icity=undef useperlio=undef d_sfio=undef uselargefiles=define use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=u +ndef Compiler: cc='gcc', optimize='-O2', gccversion=2.95.2 19991024 (release) cppflags='-fno-strict-aliasing -I/opt/local/include -I/opt/local/g +nu/include -I/opt/local/X11/include -D_LARGEFILE_SOURCE -D_FILE_OFFSE +T_BITS=64' ccflags ='-fno-strict-aliasing -I/opt/local/include -I/opt/local/g +nu/include -I/opt/local/X11/include -D_LARGEFILE_SOURCE -D_FILE_OFFSE +T_BITS=64' stdchar='unsigned char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +6 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=8, usemymalloc=y, prototype=define Linker and Libraries: ld='gcc', ldflags ='-L/opt/local/lib -L/opt/local/gnu/lib -L/opt/l +ocal/X11/lib ' libpth=/usr/lib /usr/ccs/lib /opt/local/lib /opt/local/gnu/lib /op +t/local/X11/lib libs=-lsocket -lnsl -ldb -ldl -lm -lc -lcrypt -lsec libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -Wl,-E' cccdlflags='-fPIC', lddlflags=' -W,l-E -G -L/opt/local/lib -L/opt/ +local/gnu/lib -L/opt/local/X11/lib' Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under solaris Compiled at Dec 21 2000 19:25:43

-- Hofmator


In reply to Re: Re: use bytes and length problem by Hofmator
in thread use bytes and length problem by muad33b

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.