#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my %hash = (1 => {1 => 1}); my $key = '1'; print "$hash{'$key'}{'$key'}\n"; print Dumper(\%hash); #### Use of uninitialized value in concatenation (.) or string at junk.pl line 9. $VAR1 = { '1' => { '1' => 1 }, '$key' => {} };