in reply to setting hash keys by array
use Data::Dumper; my @keys = qw( this that those ); my $node = \\my %hash; # edit: this was my old way... # my $i = 0; # $node = \$$node->{$keys[$i++]} while $i < @keys; # thanks to Juerd $node = \$$node->{$_} for @keys; $$node = "value"; print Dumper \%hash;
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker, who'd like a job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: setting hash keys by array
by Juerd (Abbot) on Sep 09, 2002 at 16:53 UTC | |
by demerphq (Chancellor) on Sep 09, 2002 at 18:20 UTC | |
by fruiture (Curate) on Sep 09, 2002 at 17:55 UTC | |
by japhy (Canon) on Sep 09, 2002 at 17:21 UTC | |
Re: Re: setting hash keys by array
by hotshot (Prior) on Sep 10, 2002 at 06:58 UTC | |
by demerphq (Chancellor) on Sep 10, 2002 at 14:27 UTC | |
Re: Re: setting hash keys by array
by shotgunefx (Parson) on Sep 09, 2002 at 17:09 UTC | |
by japhy (Canon) on Sep 09, 2002 at 17:23 UTC | |
by shotgunefx (Parson) on Sep 09, 2002 at 17:36 UTC |