This function returns a Two-element list consisting of the key and value pair for the next element of a hash when called in List context, so that you can iterate over it. Whereas it returns only the key for the next element of the hash when called in scalar context.
Syntax: each MY_HASH
MY_HASH is passed as a parameter to this function
A 2-element list of key-value pairs for the List context whereas only the key for the scalar context.
Geek = 3 of = 2 Geeks = 1
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.