Makistos
10/28/2013 - 7:44 AM

This code demonstrates how to work with hex numbers in Perl. #hexadecimal-numbers #perl

This code demonstrates how to work with hex numbers in Perl. #hexadecimal-numbers #perl

my $hex;
my $num;

$num = hex(pop @ARGV);

while(<>)
{
    next if !/^0x/;
	$hex = unpack("H*", pack("N", $num));	
	print "0x" . $hex . " " . $_;
	$num += 4;
}