# 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;
In reply to Re: hash problem
by tinita
in thread hash problem
by m.y
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |