http://qs321.pair.com?node_id=471754


in reply to Can a hash self reference?

Your problem, I think, is that you're trying to do this all at once - at the time you ask for the self-referencing portion, it's not actually been stored in the hash yet. You need to break this up into smaller chunks, so that the values you want are defined by the time you ask for them:
my %hash; $hash{1}{ONE} = "testdir"; $hash{1}{TWO} = "tmpdir"; $hash{2}{LOCATIONA} = "$hash{1}{ONE}/$hash{1}{TWO}/my_file.txt"; $hash{2}{LOCATIONB} = "$hash{1}{TWO}/$hash{1}{ONE}/my_file.txt"; print "$hash{2}{LOCATIONA} = location a\n"; print "$hash{2}{LOCATIONB} = location b\n";
as an example.