in reply to Re^6: Big Int to hex with 5.6
in thread Big Int to hex with 5.6
Slight variations failed completely, though :)#!/usr/local/bin/perl5.6.2 use Math::BigInt; BEGIN { if (!exists &Math::BigInt::as_hex) { *Math::BigInt::as_hex = sub { my $i = shift; my $hex = ''; do { my $mod = $i % 16; $hex .= sprintf("%x", $mod); } while $i = $i / 16; scalar reverse $hex; } } } $z = new Math::BigInt("1234567890"x 3); print $z->as_hex();
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^8: Big Int to hex with 5.6
by ZlR (Chaplain) on Dec 13, 2004 at 00:56 UTC |