in reply to Re^3: Why does each() always re-evaluate its argument? (Updated x2 - experimental "for_list" )
in thread Why does each() always re-evaluate its argument?
Actually I'm surprised that copying large hashes into a list can compete with the built-in iterator of perl hashes.
1) There's no copying, and 2) it uses the built-in iterator.
When we say "returns a list", we simply mean "returns zero or more scalars". It's not a data structure. You don't copy into a list since there's no such thing. We're talking about pushing pointers onto the stack. Which is exactly what keys, each or any other approach would have to do as well. There's no extra work here, so it shouldn't be surprising that it's not any slower.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Why does each() always re-evaluate its argument? ("for_list" )
by LanX (Saint) on Dec 07, 2023 at 02:49 UTC | |
by ikegami (Patriarch) on Dec 07, 2023 at 20:11 UTC | |
by LanX (Saint) on Dec 07, 2023 at 20:20 UTC | |
by ikegami (Patriarch) on Dec 07, 2023 at 20:27 UTC | |
by NERDVANA (Priest) on Dec 07, 2023 at 23:36 UTC | |
|