Hi, I am very newbie for using the function 'pack', and here I have some questions :

Q1. Can I expect that pack can do this for me ?
    - compress a text file in smaller size
    - besize template 'aAuU', anything else tempplate I can use to prepare fix length 
data ?
    - if yes, but how do I assuming the block size is? In case,  if I write a binary 
file and I wanna use seek.

Q2. Does the below results of code can be explained ?

my @arr = ('aa', '999', '!!');
my @back = ();

my @p = qw/a A Z b B h H c C s S i I l L n N v V j J f d F  p P u U w x X/;
               

for $x(@p) 
{ eval "\nprint \"$x ->\"; [EMAIL PROTECTED] = unpack \"${x}3${x}3${x}3\", \(pack 
\"${x}3${x}3${x}3\", [EMAIL PROTECTED]); print \"\<\$_>\" for [EMAIL PROTECTED]; print 
\"\\n\"; " };

Then I got results :

< snipped results... >
b -><110><111><110>
B -><110><111><110>

what is b and B's return value stands for now ?

h -><aa0><999><110>
H -><aa0><999><110>

what is h and H's return value stands for now ?
Why 'aa' returns 'aa', but '!!' return 11 ( or maybe 110 ) ?

< snipped results... >
f -><0><999><0><0><0><0><0><0><0>
d -><0><999><0><0><0><0><0><0><0>
F -><0><999><0><0><0><0><0><0><0>

Is that this kind of templates are just fine for handling numbers ? 
The pack way is just like doing something like print 'X' + 1, so got zero result ?
but, how come the return array contains so many elems ? Where are they from ?
And I make a guess is have I convert my string to ascii code before I try to pack them 
?

< snipped results... >
u -><aa999!!><><>

Why arrays joined while other elems are still given ?

< snipped results... >

Q3. Is that I always have to do something more before I do unpack ? 
but not just unpack with the same way as I pack ?

This is really a uneasy understanding function in perl... I do really very apperciate 
if anybody would kindly explain some more... and perhaps give some more practical 
exmple reference...

TIA


Reply via email to