Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Behaviour of unpack() with the Z template

by andal (Hermit)
on Feb 08, 2017 at 07:04 UTC ( [id://1181371]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    When unpacking, A strips trailing whitespace and nulls,
    Z strips everything from the first null to the end,
    and a returns data with no stripping at all.
    
  2. or download this
    $b = pack("Z*C", "test", 10)
    ($str, $byte) = unpack("Z*C", $b);
    
  3. or download this
    When unpacking, a grabs everything and returns unchanged,
    A grabs everything but strips from first null to the end
    and trailing spaces.
    Z stops after first null, the null is stripped from data.
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-19 15:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found