0

Say I have something like:

$funkyHash = @{
    "Z28" = @(13251, 13458, 78910)
    "Z14" = @(12356, 12348)
    "z15" = @(12344)
}

How do I for instance, pull out the "z15" array, add a value, lets say 456, and make sure that it results in:

$funkyHash = @{
    "Z28" = @(13251, 13458, 78910)
    "Z14" = @(12356, 12348)
    "z15" = @(12344, 456)
}

...within funkyHash?

1
  • 2
    $funkyHash['z15'] += 456 Commented Jan 24, 2019 at 20:00

1 Answer 1

2

I've tried as per below, and seems working.

> $funkyHash

Name                           Value
----                           -----
z15                            {12344}
Z28                            {13251, 13458, 78910}
Z14                            {12356, 12348}

> $funkyHash["z15"] += @(999)
> $funkyHash

Name                           Value
----                           -----
z15                            {12344, 999}
Z28                            {13251, 13458, 78910}
Z14                            {12356, 12348}
Sign up to request clarification or add additional context in comments.

3 Comments

But what are those enums? I was trying for arrays.
...or are they arrays?
The $funkyHash is a hash table of arrays of integer. Arrays: learn.microsoft.com/en-us/powershell/module/…. Hash tables: learn.microsoft.com/en-us/powershell/module/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.