almut followed the same suggestion that I had.
I'm not sure I understood what you're looking for; but here is a little program that shows a similar strategy to almut's...I think it is what you were looking for.
#!/usr/bin/perl my %hash; my $rec_format_name = "foo"; my $rec_property = "color"; my $field_number = 3; my $field_property = "length"; $hash{$rec_format_name}{$rec_property}[$field_number]{$field_property} + = 7; my $value = $hash{$rec_format_name}{$rec_property}[$field_number]{$field_prop +erty}; print "\$rec_format_name = $rec_format_name\n"; print "\$rec_property = $rec_property\n"; print "\$field_number = $field_number\n"; print "\$field_property = $field_property\n"; print "-------------------------------------------\n"; print "\$value = $value\n"; exit(0);
When run, here is the output:
$rec_format_name = foo $rec_property = color $field_number = 3 $field_property = length ------------------------------------------- $value = 7
This uses Perl's autovivication to instantiate the initial hash and all of its substructure. Perl takes care of all of the dereferencing for you...so you don't have use all of the embedded curly-braces. In the suggested references/tutorials that mr_mischief offered, it talks about the strategy of doing the dereferencing using the -> syntax and the rules for when you can ommit the ->'s...which allows the syntax that almut suggested and that I have used in the above little script.
In reply to Re^2: double hash, array, and hashed data structure
by ack
in thread double hash, array, and hashed data structure
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |