Created
June 28, 2019 16:00
-
-
Save jstaursky/4895b18e33c840a5745aae8b83b003e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use warnings; | |
while (read STDIN, my $octets, 3) { | |
# converts the 3 octal numbers to equivalent decimal number and then said | |
# decimal number into its hex equivalent. | |
$hex_fmt = sprintf "%02x", oct($octets); | |
# print out hex in raw hex byte values. | |
print pack("H*", $hex_fmt); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
UPDATE
0xa0
is newline in hex. So just use that when appropriate.