Question:
I want to delete a specific value from hashtable.
The table looks like this:
1 2 3 4 |
Name Value ---- ----- column {test, test2} |
How can I delete the “test2” value?
I tried the following:
$myhashtable.remove(“test2”)
which unfortunately does not work.
Could someone help me with this? Thanks!
Answer:
The example that you provided looks like a hashtable of hashtables. So you would need to do:
1 2 |
$myhashtable['column'].Remove('test2') |
If it is a hashtable where the value is an array, then you would need to do this:
1 2 |
$myHashTable['column'] = ($myHashTable['column'] | ?{$_ -ne 'test2'}) |