Geeks With Blogs

News QTP and Stuff
Theo Moore Questions... Morphology? Longevity? Incept dates?

Been poking about in Windows Powershell. It's pretty sharp. I like it, and it's powerful as heck, but I am having to learn how to add to my toolset. Seems like I don't need it every day, but when I do, it's just the thing.

Anyway, I'd read about arrays in PS for sometime without really thinking about something: PS flattens arrays. No multidimensional arrays at all. Which, of course, confused me, given the power of MD arrays. So, why would they do that?

Only thing I can think of is that PS creates standard interfaces around "things" so that the code plugs together smoothly. Remember how a lot of your Micronauts fit? They did because they had that standard interface (I know if you are reading this you probably knew that, but I wanted to work in a reference to Micronauts; I loved those toys as a kid...I had tons....). I was reading in one of the Apress books on the subject, and the author points out that collections and arrays are exactly the same way and have exactly the same interface. Ergo, the array must be flattened.

Leastways, that's my best guess.

Posted on Wednesday, August 20, 2008 1:20 PM | Back to top


Comments on this post: Windows Powershell: Flattens arrays?

# re: Windows Powershell: Flattens arrays?
Requesting Gravatar...
You can work with multidimensional arrays in PowerShell (or nested Hashtables, or Custom objects for that matter .

$a = (1,2),('a','b')
$a[0]
1
2

$a[1]
a
b

$a[1][1]
b
$a[1][0]
a

Greetings /\/\o\/\/
Left by /\/\o\/\/ on Aug 22, 2008 2:41 PM

Comments have been closed on this topic.
Copyright © Theo Moore | Powered by: GeeksWithBlogs.net