小编Ale*_*ndr的帖子

如何在Perl中取消定义散列键的值?

我想知道如何在Perl中取消定义散列键的值.有人可以请更正我的代码吗?

#!/usr/bin/perl

use strict; 
use warnings;
my %hash;


undef($hash{"a"});
undef($hash{"b"});
print scalar values %hash; # i need here 0
print scalar keys %hash; # and here 2
Run Code Online (Sandbox Code Playgroud)

perl hash

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

标签 统计

hash ×1

perl ×1