相关疑难解决方法(0)

双箭头(=>)运算符如何在Perl中工作?

我知道=>运算符的哈希使用,就像这样

$ cat array.pl
%ages = ('Martin' => 28,
         'Sharon' => 35,
         'Rikke' => 29,);

print "Rikke is $ages{Rikke} years old\n";
$ perl array.pl
Rikke is 29 years old
$
Run Code Online (Sandbox Code Playgroud)

我认为这只是初始化哈希的语法,但在答案中如何在Perl中将变量限定为const/final?,=>已经被这样使用了

use Readonly;
Readonly my $infilename => "input_56_12.txt";
Run Code Online (Sandbox Code Playgroud)

究竟是什么=>意思?有更多的方法=>可以使用吗?

perl hash operators perl-data-structures

22
推荐指数
2
解决办法
2万
查看次数

标签 统计

hash ×1

operators ×1

perl ×1

perl-data-structures ×1