Is perl's each function worth using?

后端 未结 8 1771
忘掉有多难
忘掉有多难 2021-01-17 11:37

From perldoc -f each we read:

There is a single iterator for each hash, shared by all each, keys, and values

8条回答
  •  Happy的楠姐
    2021-01-17 12:19

    each() can be more efficient if you are iterating through a tied hash, for example a database that contains millions of keys; that way you don't have to load all the keys in memory.

提交回复
热议问题