5.1 More About Data Types5.1.1 Basic Data Types (Scalar, Array, Hash)5.1.2 Package, Scope, Privacy, and StrictnessPackage and Scope5.1.3 Naming Conventions5.1.4 Assignment Statements5.2 Scalars, Arrays, and Hashes5.2.1 Scalar VariablesAssignmentThe defined FunctionThe undef FunctionThe $_ Scalar Variable5.2.2 ArraysAssignmentOutput and Input Special Variables ($, and $“)Array SizeThe Range Operator and Array AssignmentAccessing ElementsLooping Through an Array with the foreach LoopArray Copy and SlicesMultidimensional Arrays—Lists of Lists5.2.3 Hashes—Unordered ListsAssignmentAccessing Hash ValuesHash SlicesRemoving Duplicates from a List Using a Hash5.2.4 Complex Data Structures5.3 Array Functions5.3.1 Adding Elements to an ArrayThe push FunctionThe unshift Function5.3.2 Removing and Replacing ElementsThe delete FunctionThe splice FunctionThe pop FunctionThe shift Function5.3.3 Deleting NewlinesThe chop and chomp Functions (with Lists)5.3.4 Searching for Elements and Index ValuesThe grep Function5.3.5 Creating a List from a ScalarThe split Function5.3.6 Creating a Scalar from a ListThe join Function5.3.7 Transforming an ArrayThe map Function5.3.8 Sorting an ArrayThe sort Function5.3.9 Checking the Existence of an Array Index ValueThe exists Function5.3.10 Reversing an ArrayThe reverse Function5.4 Hash (Associative Array) Functions5.4.1 The keys Function5.4.2 The values Function5.4.3 The each Function5.4.4 Removing Duplicates from a List with a Hash5.4.5 Sorting a Hash by Keys and ValuesSort Hash by Keys in Ascending OrderSort Hash by Keys in Reverse OrderSort Hash by Keys NumericallyNumerically Sort a Hash by Values in Ascending OrderNumerically Sort a Hash by Values in Descending Order5.4.6 The delete Function5.4.7 The exists Function5.4.8 Special HashesThe %ENV HashThe %SIG HashThe %INC Hash5.4.9 Context Revisited5.5 What You Should Know5.6 What’s Next?Exercise 5: The Funny Characters