A hash is a set of key-value pairs. Perl stores elements of a hash such that it searches for the values based on its keys. Perl provides various functions to perform operations on Hashes, such as to return values of the hash, to delete elements from a hash, etc.
10 80 Deleted element: 20
Some useful functions for hash operations in Perl are listed below:
|values()||Returns the list of all the values stored in a Hash|
|keys()||Returns all the keys of the HASH as a list|
|each()||Returns a Two-element list consisting of the key and value pair in List context and key for the next element when called in scalar context|
|delete()||Used to delete the specified keys and their associated values from a hash, or the specified elements in the case of an array|
- Perl Hash
- Perl | Hash Operations
- Sorting Hash in Perl
- Perl | Use of Hash bang or Shebang line
- Perl | Hash in Scalar and List Context
- Perl | Useful String functions
- Perl | Subroutines or Functions
- Perl | Useful Math functions
- Perl | Useful Array functions
- Perl | File I/O Functions
- Perl | List Functions
- Perl | Subroutines or Functions | Set - 2
- Perl | Useful File-handling functions
- Perl | String functions (length, lc, uc, index, rindex)
- Perl | Basic Syntax of a Perl Program
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.