in reply to Re: Perl leve control of hash iterators
in thread Perl level control of hash iterators
I'm not certain, but I suspect that the keys call interacts with this line, from Data::Rmap:perl -MData::Rmap=rmap_hash -le 'rmap_hash {print keys %{$_->{a}} } ({ +a=>{1,2}})'
Since the module is for general use, XS or tie-ing aren't really options. Also, $_ is aliased during the callback so that things, including hashes can be changed (sometimes leading to different disasters). This further constrains the solution space.push @return, $self->_rmap($_) for values %$_;
Thanks for your tips,
Brad
Update: I think autovivification is to blame
# added exists check perl -MData::Rmap=rmap_hash -le 'rmap_hash {print keys %{$_->{a}} if e +xists $_->{a} } ({a=>{1,2}})' 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Perl leve control of hash iterators
by diotalevi (Canon) on Feb 28, 2007 at 04:25 UTC | |
|
Re^3: Perl leve control of hash iterators
by bart (Canon) on Feb 28, 2007 at 11:27 UTC |