Subject: Time to pack
From: Ovid <[EMAIL PROTECTED]>
Date: Thu, 28 Sep 2006 07:23:37 -0700 (PDT)

}    ok my $data = pack('u', @data), 'packing data should succeed';

perldoc -f pack:

               *       Each letter may optionally be followed by a number giv-
                       ing a repeat count.  With all types except "a", "A",
                       "Z", "b", "B", "h", "H", "@", "x", "X" and "P" the pack
                       function will gobble up that many values from the LIST.
                       A "*" for the repeat count means to use however many
                       items are left, except for "@", "x", "X", where it is
                       equivalent to 0, and "u", where it is equivalent to 1
                       (or 45, what is the same).  A numeric repeat count may
                       optionally be enclosed in brackets, as in "pack
                       'C[80]', @arr".

                       ...

                       The repeat count for "u" is interpreted as the maximal
                       number of bytes to encode per line of output, with 0
                       and 1 replaced by 45.

So it's only packing the first element of the list.

Even if you changed the pack to "uu", since two uuencoded strings 
concatenated together are essentially equivalent to concatenating the 
original strings, you'll never get back exactly what you started with, 
but rather the concatenation of them.

-Pete K
-- 
Pete Krawczyk
  petek at ignore dot us
  http://www.petekrawczyk.com/

Reply via email to