in reply to hash problem
# more or less untested my $hash = {}; pushref($hash, qw(one two three)); sub pushref { my ($hash,@array) = @_; my $ref = \$hash; for (@array) { $ref = \$$ref->{$_}; } $$ref = 1; $_[0] = $hash; } # UPDATE: simplified and tested my $hash = {}; my $ref = \$hash; for (qw(one two three)) { $ref = \$$ref->{$_}; } $$ref = 1; print Dumper $hash;
|
|---|