in reply to Data::Rmap to modify an arrayref of arrayrefs
It didn't work. I tried return in its place, but that also doesn't work, so I just used $_;.} else { $_ = $_; }
#!/usr/bin/perl use strict; use warnings; use Data::Rmap qw(:all); use Data::Dump qw(dump); use Storable qw(dclone); my $initial = ['note', ['shopping', ['item']]]; my $clone = dclone $initial; my($dump) = rmap_all { if( ref and $_->[0] eq 'shopping' ) { my @item = map { [ 'item' => '=>' => $_ ] } qw(bread butter beans) +; my $newdata = [ shopping => \@item ]; $_ = $newdata; } else { $_ } } $clone; print dump($dump);
|
|---|