in reply to Re^3: Indepedent lazy iterators for the same hash?
in thread Indepedent lazy iterators for the same hash?
Maybe an example helps illustrating the point.
What is more efficient:
for (1..1e6) { ... }
or
@k=1..1e6; for (@k) {...} ?
> but if you want absolutely no dependencies,
I definitely need no dependency b/c this lazy iterator breaks if comparing identical hashes.
This seems like a trivially avoided case but, what if you working with deeply nested data-structures?
This effectively means:
NEVER use each within an iterator operating on a shared data structure, cause it has global side effects!
> you can always roll your own iterator.
I'm well aware, thats why asked how to avoid this.
Cheers Rolf
( addicted to the Perl Programming Language)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Indepedent lazy iterators for the same hash?
by AnomalousMonk (Archbishop) on Jun 30, 2013 at 23:33 UTC |