O'Reilly logo

Windows PowerShell™ 2 For Dummies® by Steve Seguis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 11. Grouping Data Using Arrays and Hash Tables

In This Chapter

  • Exploring arrays

  • Making and using arrays

  • Resizing arrays

  • Making multidimensional arrays

  • Examining other uses for arrays

  • Using hash tables

People naturally try to group similar things, whether those things are shapes, patterns, objects, or even abstract thoughts. Perhaps grouping is our way of creating order in a world that naturally wants to fall apart. To take off my philosopher's hat for a second, grouping things makes sense for some very obvious reasons. For one thing, groups allow you to organize a large number of items in manageable units. An additional benefit is that you can refer to a group of items by a single name rather than having to know the name of each individual item. Arrays are one way you can group data elements in Windows PowerShell, and hash tables provide an efficient way to store data elements by using name/value pairs.

In this chapter, you use arrays and hash tables to group data elements together into a manageable structure rather than just having a variable for each value you want to store. Arrays and hash tables are some of the most effective and widely-used ways for organizing large groups of related data, and you'll see these concepts used repeatedly within this book and in many of the scripts you'll find out there.

Taking an In-Depth Look at Arrays

An array is a structure for organizing data sequentially in which each element is accessed via an index value. In practice, you use arrays whenever ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required