in reply to Data::Rmap to modify an arrayref of arrayrefs

It wouldn't do  'item' => 'bread' but it would do bread =>. This was as close as I could get:
#!/usr/bin/perl use strict; use warnings; use Data::Rmap qw(:all); my @item = ('bread', 'butter', 'beans'); my $initial = [ note => [ shopping => [ $item[0] => $item[1] => $item[2] => ], ], ]; use Data::Dumper; my ($dump) = rmap_array { if ($_->[0] eq 'shopping') { my @item; for my $item qw(bread butter beans) { push @item, [ item => $item ]; } my $newdata = [ shopping => \@item ]; cut($newdata) } else { $_; } } my @item ; warn Dumper($initial, $dump);
Updated: fixed typo

Replies are listed 'Best First'.
Re^2: Data::Rmap to modify an arrayref of arrayrefs
by metaperl (Curate) on Jul 02, 2011 at 09:34 UTC