11.3. Taking References to Hashes11.3.1. ProblemYou need to manipulate a hash by reference. This might be because it was passed into a function that way or because it's part of a larger data structure. 11.3.2. SolutionTo get a hash reference:
To dereference a hash reference:
To check whether something is a hash reference:
11.3.3. DiscussionThis example prints out all keys and values from two predefined hashes:
Access slices of hashes by reference as you'd access slices of arrays by reference. For example:
11.3.4. See AlsoThe Introductionin Chapter 5; Chapter 8 of Programming Perl; perlref(1); Recipe 11.9
Copyright © 2003 O'Reilly & Associates. All rights reserved. |
|