#! /usr/bin/perl -w # Set up some stuff for this example use strict; use Data::Dumper; my %hash; my @levels = qw(a b c); my $value = 5; # The next three lines are the essence: my $work = \\%hash; $work = \$$work->{$_} for @levels; $$work = $value; # Show that it worked print Dumper(\%hash); #### my $hash; my $work = \$hash; $work = \$$work->{$_} for @levels; $$work = $value; #### $hash{join(",", @levels)} = $value;