# for https://perlmonks.org/?node_id=11110997 # by bliako, 08/01/2020 use strict; use warnings; use Math::BigInt; use Digest::SHA qw(sha256_hex); for(my $i=1;$i<=10;$i++){ # the sha as a hex string (no '0x' prepended) my $hexstr = sha256_hex($i); # to create a bigint from a hex string we need to prepend '0x' to it my $digest = Math::BigInt->new('0x'.$hexstr); # specify accuracy and precision $digest->accuracy(80); $digest->precision(1); # operate print "$i $digest\n"; $digest /= 64; print "$i $digest\n"; }