-
-
Save selftaught/5ba8e942f68ae38719243de8d07bcaea 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 5.010; | |
use strict; | |
use warnings; | |
use Getopt::Long; | |
my $address; | |
GetOptions('a|address=s' => \$address); | |
if ($address) { | |
my $len; | |
my @bytes = split('', $address); | |
if (($len = length $address) == 10 && | |
$bytes[0] eq '0' && lc $bytes[1] eq 'x') { | |
$address = substr $address, 2, $len; | |
} | |
say '\x' . join ('\x', reverse ($address =~ m/../g)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment