G'day polarbear,
What you are describing is the default behaviour for Data::Dumper. You can change it by setting $Data::Dumper::Deepcopy:
$ perl -Mstrict -Mwarnings -e ' use Data::Dumper; $Data::Dumper::Deepcopy = 1; my @maintainers = qw/ worker@company.com manager@company.com /; my %services = ( service1 => { email => \@maintainers }, service2 => { email => \@maintainers }, ); print Data::Dumper->Dump( [ \%services ], [qw/*services/] ); ' %services = ( 'service1' => { 'email' => [ 'worker@company.com', 'manager@company.com' ] }, 'service2' => { 'email' => [ 'worker@company.com', 'manager@company.com' ] } );
Update: I may have misinterpreted "I don't want the lists connected in any way." as the cross-referencing of the lists output by Data::Dumper rather than the lists pointed to by the arrayrefs. If this is the case, the email => [ @maintainers ] solution would be the way to go. Thanks, frozenwithjoy.
-- Ken
In reply to Re: Putting an array into a hash gives an unexpected reference to the hash itself.
by kcott
in thread Putting an array into a hash gives an unexpected reference to the hash itself.
by polarbear
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |