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

Re: Perl Hex ASCII pack unpack

by ikegami (Patriarch)
on Sep 26, 2014 at 05:21 UTC ( [id://1102087]=note: print w/replies, xml ) Need Help??


in reply to Perl Hex ASCII pack unpack

I presume you're asking how to get the string of 9 bytes that string represents.

$x =~ tr/://d; my $y = pack('H*', $x);
my $y = pack('H*', $x =~ tr/://dr); # 5.14+ required
(my $y = $x) =~ s/([0-9a-fA-F]{2}):?/chr(hex($1))/eg;
my $y = $x =~ s/([0-9a-fA-F]{2}):?/chr(hex($1))/egr; # 5.14+ required
my $y = pack 'C*', map hex, split /:/, $x;
my $y = join '', map chr hex, split /:/, $x;

Replies are listed 'Best First'.
Re^2: Perl Hex ASCII pack unpack
by waytoperl (Beadle) on Sep 26, 2014 at 19:23 UTC

    Thanks

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-24 02:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found