如何从Perl中的哈希中删除键?
问题描述:
如何从现有地图中删除密钥?
How do I remove the key from an existing map?
if (exists $sampleMap{1})
{
#Here I want to remove the "1" key from sampleMap
}
答
使用delete
删除哈希键:
if (exists $sampleMap{1})
{
delete $sampleMap{1}; #Here I want remove the "1" key from sampleMap.
}
有关更多详细信息,请查看删除.
For more details, take a look at delete.