in reply to
Bin 2 Hex
uhm, what about:
my $hex = sprintf "%05x", oct '0b'.$binary;
see
perlfunc
(hex, oct, sprintf)
Comment on
Re: Bin 2 Hex
Download
Code
Replies are listed 'Best First'.
Re^2: Bin 2 Hex
by
Streen
(Sexton)
on Jun 03, 2004 at 08:39 UTC
Oh, thanks a lot...
Now I tried to reverse it (hex->bin), how can I make this?
Okay this was easier than I thought, it did not function because I had a typo:
hex2bin:
my $bin = sprintf "%19b", oct '0x'.$hex;
[download]
[reply]
[d/l]
In Section
Seekers of Perl Wisdom