Shu*_*ham 1 perl unpack
我无法理解"W"到底是做什么的.
my $x = "this is my string"; print unpack("W",substr($x,0,1));
印刷品:116
my $x = "this is my string"; print unpack("W",$x);
仍然打印:116
Eri*_*rom 6
来自perldoc:W An unsigned char value (can be greater than 255).
W An unsigned char value (can be greater than 255).
你的两个例子都返回相同的东西,因为你的unpack参数"W"只消耗一个字符.试试吧"W*".
"W"
"W*"
归档时间:
15 年,10 月 前
查看次数:
249 次
最近记录: