使用的所有密钥都应存在于初始%哈希定义中.
use strict;
my %hash = ('key1' => 'abcd', 'key2' => 'efgh');
$hash{'key3'} = '1234'; ## <== I'd like for these to fail at compilation.
$hash{'key4'}; ## <== I'd like for these to fail at compilation.
Run Code Online (Sandbox Code Playgroud)
有没有办法做到这一点?