Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

RE: RE: pack / unpack woes

by davorg (Chancellor)
on Aug 24, 2000 at 17:54 UTC ( [id://29417]=note: print w/replies, xml ) Need Help??


in reply to RE: pack / unpack woes
in thread pack / unpack woes

I think you might be misundertanding what agoth is doing with the unpack lc($FMT}, pack $FMT, @data construction. Effectively the code is equivalent to this (simplifying the templates):

$temp = pack 'A3 A4 A5', @data; @data = unpack 'a3 a4 a5', @data;

Using 'A' in the pack template will pad each field with spaces to the width of the field as given in the template and using 'a' in the unpack template will leave those spaces untouched when the string is split again (using 'A' would strip the spaces)

It might be easier to do something using sprintf and split.

--
<http://www.dave.org.uk>

European Perl Conference - Sept 22/24 2000, ICA, London
<http://www.yapc.org/Europe/>

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://29417]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-25 09:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found