in reply to Re^3: Filehandle/array naming
in thread Filehandle/array naming

A symbolic reference?

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^5: Filehandle/array naming
by bliako (Abbot) on Nov 20, 2020 at 16:55 UTC

    I was under the impression that in this case brackets around a variable name are just to clarify things and $x was a synonym to ${x}. Is ${x.$y} a special case? https://perldoc.perl.org/perlref#Not-so-symbolic-references calls that a not-so-symbolic reference! Tomorrow I will post a question as I am still confused on the boundaries.

    thanks

      JSAWS seems to be running without strictures (and warnings?) enabled, so the OPed code seems to be using honest-to-goodness symbolic references.

      Win8 Strawberry 5.8.9.5 (32) Fri 11/20/2020 12:19:01 C:\@Work\Perl\monks >perl # strictures and warnings not enabled $n = 99; ${ foo . $n } = 'zot'; print $foo99; ^Z zot
      This is the general case in these circumstances (and one of the motivations for the creation of strict).

      Update: The { } brackets in ${ foo . $n } are required for disambiguation. The statement
          $foo . $n = 'zot';
      produces a very different result.


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

        My confusion is: where does using { } brackets for disambiguation (as in print 'aa${foo}bb') stop and symbolic references start as in ${foo.$n} or ${foo.''} . Did I get { } brackets for disambiguation wrong (e.g. as in the unix shell use-case: ${XYZ} )?