不知道是否是你需要的:十进制转二进制:perl -e '$dec=10;$bin =sprintf("%b",$dec);print $bin;'反过来:perl -e '$bin=0b1010;$dec=sprintf("%d",$bin);print $dec;'