小编Kon*_*kar的帖子

调用子例程时perl autovivification

调用程序时为什么自动生效不起作用?在这种情况下有没有办法禁止它?

#!/usr/bin/env perl
no autovivification;
use Data::Dumper;

sub testsub { }

my $task;
print Dumper($task);    # $VAR1 = undef;
my $a = $task->{parent_id};
print Dumper($task);    # $VAR1 = undef;
my $b = testsub($task->{parent_id});
print Dumper($task);    # $VAR1 = {}; 
Run Code Online (Sandbox Code Playgroud)

perl autovivification

4
推荐指数
1
解决办法
76
查看次数

标签 统计

autovivification ×1

perl ×1