Why does the Dumper module place parens around the destination of the settings hash?

After reading this question and this question about the differences between my $varand my ($var), I still could not understand why the Data :: Dumper module uses parens in the following passage from my code. None of the differences described in the answers to these questions apply here.

  my($s) = {
        level      => 0,           # current recursive depth
        indent     => $Indent,     # various styles of indenting
        # a bunch of other settings removed for brevity sake
        deparse    => $Deparse,    # use B::Deparse for coderefs
        noseen     => $Sparseseen, # do not populate the seen hash unless necessary
       };

I tested it in a small script, and I see no difference between declaring this as my ($s)or how my $s. In both cases, this is a scalar hash reference, as far as I can tell.

Did I miss something?

+4
source share
2 answers

my ($s) my $s. . .

+4

, . . .

, , my(...) = ... Data:: Dumper, :

sub Reset {
  my($s) = shift;
  $s->{seen} = {};
  return $s;
}

, , , , :

my $ref = \$_[1];
my $v;

, , ... , , , , , , . ...

+6

Source: https://habr.com/ru/post/1677806/


All Articles