老唐
唐吉诃德猫
全部博文(61)
2011年(2)
2010年(37)
2009年(22)
Klose
Phyllis6
lantian5
attila_c
wale2014
brewerdo
xuy2016
study123
cyg_x
分类:
2009-06-30 14:26:18
#!/usr/bin/env perl # # This program is for transforming number between bin, oct, dec, hex. # use strict;
# decimal to binary my $decimal = 4; my $binary = unpack("B32", pack("N", $decimal)); print $binary, "\n"; # binary to decimal $decimal = 4; $binary = unpack("B32", pack("N", $decimal)); my $newdecimal = unpack("N", pack("B32", $binary)); print $newdecimal, "\n"; # decimal to oct print sprintf "%lo\n", 16; # oct to decimal print oct 10, "\n"; # decimal to hex print sprintf "%lx\n", 16; # hex to decimal print hex 0x1AB, "\n";
上一篇:CF card 启动Linux
下一篇:声卡问题
登录 注册