Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: Help me decipher code containing map function

by AnomalousMonk (Archbishop)
on May 20, 2017 at 21:58 UTC ( [id://1190769]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Help me decipher code containing map function
in thread Help me decipher code containing map function

Because  H* gives you a single string of an unlimited number, necessarily even, of hex characters, but  (H2)* gives you an unlimited number of groups of pairs (or in the case of  (H4)* quartets). The parentheses do grouping in pack/unpack templates. The groups can be quantified. BTW: This is susceptible to experimentation:

c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le "my $octetstr = qq{\xab\xcd\x00\x1d\x94\x56}; ;; my @ra = unpack 'H*', $octetstr; dd \@ra; ;; @ra = unpack '(H2)*', $octetstr; dd \@ra; ;; @ra = unpack '(H4)*', $octetstr; dd \@ra; " ["abcd001d9456"] ["ab", "cd", "00", "1d", 94, 56] ["abcd", "001d", 9456]


Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-03-29 08:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found