大佬教程收集整理的这篇文章主要介绍了%$var是否取消引用Perl哈希?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
但究竟是什么%$arg_ref?是$$解除引用哈希?
引用perldata(1):
Scalar values are always named with '$',even when referring to a scalar that is part of an array or a hash. The '$' symbol works semantically like the English word "the" in that it inDicates a single value is expected. $days # the simple scalar value "days" $days[28] # the 29th element of array @days $days{'Feb'} # the 'Feb' value from hash %days $#days # the last index of array @days
所以你的例子是:
%$arg_ref # hash dereferenced from the value "arg_ref"
我的($arg_ref)= @_;获取函数参数堆栈中的第一项,并将其放在名为$arg_ref的局部变量中.调用者负责传递哈希引用.一种更规范的写作方式是:
@H_3_10@my $arg_ref = shift;要创建哈希引用,您可以从哈希开始:
some_sub(\%hash);
或者您可以使用匿名哈希引用创建它:
some_sub({pi => 3.14,C => 4}); # Pi is a gross approximation.
以上是大佬教程为你收集整理的%$var是否取消引用Perl哈希?全部内容,希望文章能够帮你解决%$var是否取消引用Perl哈希?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。