I’ve been working again with PowerShell, doing some new things. There are still a few nuances to a newbie like me. For instance, while it is easy to create arrays, it is a bit more arcane to remove items from an array. Thankfully, I found a site that gave me the answers I need.
To remove the first item in an array, reassign only items 1 through the length of the array back into the array (or a new array). Remember that arrays are indexed with the first item as 0, not 1.
$array = $array[1..$array.Length]
Not knowing “PowerShell” (searching the web taught me it’s a win32 scripting tool), I’d say look up ‘shift’, ‘splice’, ‘pop’ etc. but that same search taught me that’s not possible with PowerShell. What a nasty way to do all this!
Why not just install Perl? 😉