in reply to Elegantly dereferencing multiple references
Is there a reason why you don't work directly on the hashrefs ?
Maybe you can avoid having separate hashes in the first place :use Data::Dumper; my %x = ("a" => "red"); my %y = ("b" => "green"); modifyHash( \(%x, %y) ); sub modifyHash { my ($x, $y) = @_; $x->{a} = "circle"; $x->{b} = "square"; } print Dumper ( \(%x, %y) );
use Data::Dumper; my %coords = ( x => { a => "Red" }, y => { b => "Green" } ); modifyHash(\%coords); sub modifyHash { my ($c,) = @_; $c->{x}{a} = "circle"; $c->{y}{b} = "square"; } print Dumper \%coords;
|
|---|