use strict;
use warnings;
use Data::Rmap;
my $href = [];
my $struct = {
foo => $href,
bar => $href,
};
rmap_all { $_ = 123 if 'ARRAY' eq ref } $struct;
use Data::Dumper;
print Dumper $struct;
The above should convert both $struct values to 123, but it only does one of them. This appears to be because the “seen” hash is populated before the coderef rather than after it.