Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

RE: RE: pack / unpack woes

by davorg (Chancellor)
on Aug 24, 2000 at 17:54 UTC ( #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.


European Perl Conference - Sept 22/24 2000, ICA, London

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2022-05-22 22:26 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (81 votes). Check out past polls.