Paul Kraus wrote:
> You are of course correct. After some digging I seems that the problem
> was in my unpack statement. When I actually checked the packed
> variable all the data was there.
> 
> I was doing .. My ($a,$b) = unpack("A A",$buffer);
> When I added ... Unpack "A* A*"....
> It sort of worked. It just unloads $buffer into $a.
> 
> Here is the snippet of code.
> $date contains scalar(localtime).
> $fields[0] contains a 10 character order number.
> 
>  $buffer = pack("A* A*",$date,$fields[0]);
>     print "\$buffer = $buffer\n";
> 
>     my ($a, $b) = unpack("A* A*", $buffer);
>     print "\$a=$a\n\$b=$b\n";
> 
> Output
> ------
> $buffer = Tue Jan 21 15:17:09 2003GULLIFER
> $a=Tue Jan 21 15:17:09 2003GULLIFER
> $b=
> 
> So know I am going to assume that pack and unpack could care less
> about the data. The unpack needs to know the exact length of each
> record in order to unpack the data correctly into separate variables.
> 
> If so then that really makes this useless to me :(
> So all pack and unpack are is wrapped up '.' and substr.
> 

Paul,
        Usually you have a set length that you are going with. SO date is 10
maybe and order # is 20, so you would use "A10A20" for the pack and unpack
to break out the data into variables or arrays.  The pack/unpack is really
for extracting from fix length record setups and/or getting of binary data
so you can work with it.  Not useless, but depends on what you are after and
what you want to do.

Wags ;)


**********************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
****************************************************************


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to