#!/usr/bin/perl -w use strict; my %test_hash = ("foo_bar" => "baz"); my $test = "foo"; my $key = "${test}_bar"; my $var1 = "aaa/$test_hash{$key}"; printf("var1 = $var1\n"); my $var2 = "aaa/$test_hash{${test}_bar}"; printf("var2 = $var1\n"); #### > ./braces_inside_braces.pl Bareword found where operator expected at ./braces_inside_braces.pl line 14, near "${test}_bar" (Missing operator before _bar?) syntax error at ./braces_inside_braces.pl line 14, near "${test}_bar" Execution of ./braces_inside_braces.pl aborted due to compilation errors.