Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Split any number into string of 8-bit hex values (=1 byte)

by tybalt89 (Monsignor)
on Aug 30, 2021 at 09:06 UTC ( [id://11136197]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    
    ...
      my @bytes = reverse sprintf('%016X', $n) =~ s/^(?:00)*\B//r =~ /../g
    +;
      print "$n => @bytes\n";
      }
    
  2. or download this
    0 => 00
    2 => 02
    ...
    2000 => D0 07
    20000 => 20 4E
    200000 => 40 0D 03
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-18 02:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found