For every function, I presented the syntax forms and a brief description. This was necessary to help you better understand how to use the topics. If you want a complete description of these functions, you should go for additional information to the Perl official site by following the link perldoc.
If you take your time to skim through the Table of Contents of this eBook, you’ll see what you should expect to find here. From using these functions with simple arrays and hashes or with more complex data structures as arrays of hashes, hashes of arrays or hashes of hashes, you’ll find here a lot of commented examples to help you find a quick solution to your problem.
The examples included in this eBook are not only about the hash functions, but also show you how to use these functions together with the operators, special variables, statements, regular expressions and with simple or complex data structures. In the same time are provided interesting examples about how to use these functions with @$_, %{}, ||, &&, =>, @{}, [], {}, $_, $".
Complete solutions are provided for almost all the examples. Each example can be tested, modified and run individually. Every example shows you a way to resolve a specific problem, allowing you to find out a quick answer to your problem or question.
Of course you can continue searching through the forums to find the answer of your question but in this case you need to choose, test and interpret yourself the information provided in the forums.
| 1. | Copyright |
| 2. | Introduction |
| 2.1. | How to run the examples included in this eBook |
| 2.1.1. | How to run the script in Windows |
| 2.1.2. | How to run the script in Linux |
| | |
| 3. | Functions for real %HASHes |
| | |
| 3.1. | The delete function |
| 3.1.1. | The syntax forms |
| 3.1.2. | How to us delete on a hash inside a foreach loop |
| 3.1.3. | How to use delete with a hash reference |
| 3.1.4. | How to return the deleted entries from a hash |
| 3.1.5. | How to use delete on an array |
| 3.1.6. | delete versus undef |
| 3.1.7. | delete versus grep on an array |
| 3.1.8. | delete versus splice on an array |
| 3.1.9. | How to use delete against an array of hashes (@AoH) |
| 3.1.10. | How to use delete against a hash of arrays (%HoA) |
| 3.1.11. | How to use delete against a hash of hashes |
| | |
| 3.2. | The each function |
| 3.2.1. | The syntax forms |
| 3.2.2. | How to use the each function with a hash |
| 3.2.3. | How to use the each function with an array |
| 3.2.4. | How to use each with delete |
| 3.2.5. | How to use the each function with an array of hashes (@AoH) |
| 3.2.6. | How to use the each function with a hash of arrays (%HoA) |
| 3.2.7. | How to use the each function with a hash of hashes (%HoH) |
| | |
| 3.3. | The exists function |
| 3.3.1. | The syntax forms |
| 3.3.2. | How to use exists with hashes |
| 3.3.3. | How to use exists with a hash reference |
| 3.3.4. | How to use exists with arrays |
| 3.3.5. | How to use exists with subroutines |
| 3.3.6. | How to use exists with next and unless |
| 3.3.7. | How to use exists with a hash of arrays (%HoA) |
| 3.3.8. | Using exists to avoid autovivification in a hash of hashes (%HoH) |
| | |
| 3.4. | The keys function |
| 3.4.1. | The syntax forms |
| 3.4.2. | How to use keys in a list context |
| 3.4.3. | How to use keys in a scalar context |
| 3.4.4. | How to use keys with a hash reference |
| 3.4.5. | How to use keys with while |
| 3.4.6. | How to use keys with foreach |
| 3.4.7. | How to use keys with grep |
| 3.4.8. | How to use keys with map |
| 3.4.8.1. | How to print the elements of a hash |
| 3.4.8.2. | How to get the union of two arrays |
| 3.4.9. | How to use keys with grep, map and regex |
| 3.4.10. | How to sort the hash keys |
| 3.4.11. | How to sort the hash values |
| 3.4.12. | How to sort the hash keys by length |
| 3.4.13. | How to sort the hash values by length |
| 3.4.14. | How to use keys against an array of hashes (@AoH) |
| 3.4.15. | How to use keys against a hash of arrays (%HoA) |
| 3.4.15.1. | How to filter the elements of the inner array |
| 3.4.15.2. | How to print a hash of arrays using keys and foreach |
| 3.4.15.3. | How to print a hash of arrays using keys and map |
| 3.4.15.4. | How to use sort and keys on a hash of arrays |
| 3.4.16. | How to use keys against a hash of hashes (%HoH) |
| 3.4.16.1. | How to retrieve the unique values from a hash of hashes |
| 3.4.16.2. | How to use sort and keys with a hash of hashes |
| | |
| 3.5. | The values function |
| 3.5.1. | The syntax forms |
| 3.5.2. | How to use values with hashes |
| 3.5.3. | How to use values with arrays |
| 3.5.4. | How to use values with a hash reference |
| 3.5.5. | How to join or to extract the hash values to an array |
| 3.5.6. | How to grep the hash values |
| 3.5.7. | How to sort the hash values |
| 3.5.8. | How to remove duplicates hash values |
| 3.5.9. | How to use values with an array of hashes (@AoH) |
| 3.5.10. | How to use values with a hash of arrays (%HoA) |
| 3.5.11. | How to use values with a hash of hashes (%HoH) |
If you consider that this book is valuable or you have some suggestions to improve its content, please send me some feedback through my contact page.