Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: Being impervious to an 'each' reset

by duckyd (Hermit)
on Dec 14, 2006 at 00:15 UTC ( [id://589701] : note . print w/replies, xml ) Need Help??


in reply to Re: Being impervious to an 'each' reset
in thread Being impervious to an 'each' reset

You could avoid copying the large hash by using a reference:
my $thingy_ref = \%Foo::Bar::Baz::thingy; foreach my $key ( keys %$thingy_ref ){ print "$key => $thingy_ref->{ $key }\n"; }

Replies are listed 'Best First'.
Re^3: Being impervious to an 'each' reset
by Fletch (Bishop) on Dec 14, 2006 at 00:27 UTC

    Erm, then you'd have a reference to the same hash you're trying to avoid resetting the each iterator and the OP would be back to square one. The iterator is a property of the underlying hash, not how it's accessed.