in reply to Re: curly braces inside of curly braces
in thread curly braces inside of curly braces

Nested paired delimiters also work:

c:\@Work\Perl>perl use strict; use warnings; my %test_hash = ("foo_bar" => "baz"); my $test = "foo"; my $var5 = qq{aaa/$test_hash{ qq{${test}_bar} }}; # qq{} in qq{} print "var5 = '$var5' \n"; ^Z var5 = 'aaa/baz'


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^3: curly braces inside of curly braces
by AnomalousMonk (Archbishop) on Feb 06, 2022 at 20:57 UTC

    I agree a surfeit of curlies or any other delimiter can cause visual indigestion, but I wanted to use as many as possible to drive the point home in the example. :)

    Update: Oops... I meant this to be a reply to LanX's post.


    Give a man a fish:  <%-{-{-{-<

Re^3: curly braces inside of curly braces
by LanX (Saint) on Feb 05, 2022 at 21:08 UTC
    Yeah true, their delimiters can be nested, but I'd chose other one(s) to avoid being distracted by other curlies like in ${test}

    qq(aaa/$test_hash{ qq(${test}_bar) });

    and readability is why I kept " in the first place

    qq(aaa/$test_hash{ "${test}_bar" });

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery