Well.... I'm not sure how your regex works BUT it works great for unsigned numbers :-)
#!/usr/bin/perl
use strict;
use warnings;
sub number2hexString {
return my $output .= join ' ', map { join ' ', sprintf('%016X'
+, $_) =~ s/^0{8}(0{4}(00)?)?//r =~ /../g } @_;
}
print number2hexString(2,20,200,2000,20000,200000)."\n";
It doesn't completely solve my problem as it does not work with unsigned signed numbers
UPDATE: sorry, I was confused, obviously the last sentence should read ... does not work with signed numbers |