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 ( #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? | Other CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2022-05-28 17:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (99 votes). Check out past polls.

    Notices?