in reply to Re: dec to bin conversion for large numbers
in thread dec to bin conversion for large numbers
This correctly producesprint dec2bin(2**31); sub dec2bin { my $str = unpack("B64", pack("N", shift)); $str =~ s/^0+(?=\d)//; # otherwise you'll get leading zeros return $str; }
But if you use anything larger than 2**31, you get10000000000000000000000000000000
11111111111111111111111111111111
@a=split??,'just lose the ego and get involved!';
for(split??,'afqtw{|~'){print $a[ord($_)-97]}
|
|---|