http://www.perlmonks.org?node_id=1033478

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am after  "00204110" but I'm not sure if the sprintf version is portable

#!/usr/bin/perl -- use Data::Dump; my $raw ="\1\24\2\0" ; dd( 'a is this portable? ', sprintf '%08X', unpack q/L</, $raw); dd( 'b is this portable? ', sprintf '%08X', unpack q/V/, $raw ); dd( 'g is this portable? ', unpack 'H*', pack 'L>', unpack q/L</, $raw + ); __END__ ("a is this portable? ", "00021401") ("b is this portable? ", "00021401") ("g is this portable? ", "00021401")

Also, a way to shorten up the pack/unpack?