Pregunta

How do I remove the key from an existing map?

if (exists $sampleMap{1})
{
      #Here I want to remove the "1" key from sampleMap
}
¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top