Perl has two separate, but largely compatible variable systems.
Package variables that are either fully qualified names $Some::Package::variableor lexical names declared with our. The package variables located in the symbol table are global for the entire program, can be the object of symbolic dereferencing, and can be provided by the dynamic scope with local.
, my, . ( , ). , . $$varname , .
:
, , our, :
our $x = 1;
our $y = 'x';
say $x;
$$y = 5;
say $x;
:
$main::x = 1;
my $y = 'x';
${$main::{$y}} = 5;
say $main::x;
- ( , , )
my %data = (x => 1);
my $y = 'x';
$data{$y} = 5;
say $data{x};
, , . , , , . , .