문제

How do I remove the key from an existing map?

if (exists $sampleMap{1})
{
      #Here I want to remove the "1" key from sampleMap
}
도움이 되었습니까?

해결책

Use delete for deleting the hash keys:

if (exists $sampleMap{1})
{
      delete $sampleMap{1}; #Here I want remove the "1" key from sampleMap.
}

For more details, take a look at delete.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top