nitesh kumar wrote:
Hi All,
Hello,
I want to convert binary data to hexadecimal.
below is the code I used for the conversion.
It is converting only for 32 bit.
Can anybody suggest me for bit containing more tham 32(it may be 64 or
128).
$ perl -le'
my %conv = map { sprintf( "%04b", $_ ), sprintf "%x", $_ } 0 .. 15;
my $str = "1010101010101010101010101010101010101010";
( my $str2 = $str ) =~ s/([01]{4})/$conv{ $1 }/g;
print $str2;
'
aaaaaaaaaa
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/