Is that actually slower? Got benchmarks to back that up?foreach my $key (keys %hash) { }
And if it IS, then why should it be? There are specialized magic iterators when the parser recognizes an impending iteration with constants, like for (1 .. 1_000_000). Why does perl not implement an automatic iterator when the parser notices a simple sort-free for (keys %foo)? That's such a common idiom I would be amazed it wasn't getting special attention.
--
[ e d @ h a l l e y . c c ]
In reply to Re^2: Efficient giant hashes
by halley
in thread Efficient giant hashes
by crenz
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |