This seems to be version specific, indicating that indeed, there was a bug / misfeature somewhere. This is what I get:
#!/usr/local/bin/perl -w use strict; use Data::Dumper; my $string="the quick brown fox"; my $packed=pack 'C/a*', $string; my $unpacked= unpack 'C/a*', $packed; print "'$unpacked'\n"; my @data= unpack 'C/a*', $packed; print Dumper(\@data); my ($len,$val)=unpack 'C/a*', $packed; print "$len:$val\n"; __END__ 'the quick brown fox' $VAR1 = [ 'the quick brown fox' ]; Use of uninitialized value in concatenation (.) or string at ./packwei +rd.pl line 11. the quick brown fox:
List context gets me just the text, as does scalar context. My perl is:
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuratio +n: Platform: osname=linux, osvers=2.4.18-bv1, archname=i686-linux uname='linux quasimod 2.4.18-bv1 #2 tue jul 2 16:22:51 cest 2002 i +686 unknown '

CU
Robartes-


In reply to Re: unpack 'C/a*' and context weirdness by robartes
in thread unpack 'C/a*' and context weirdness by BrowserUk

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.