What does the `->` syntax mean in Perl?

后端 未结 3 1271
盖世英雄少女心
盖世英雄少女心 2021-01-03 05:47
chdir($g_var->{g_loc});

I found this line in some perl code I am working with and I could not figure out what the -> means. I me

3条回答
  •  轮回少年
    2021-01-03 06:35

    -> is dereferencing a reference. $g_var contains a reference to a %hash (elements of which you'd access using $hash{key}).

    You can find more information about references in the perlreftut and perlref documentation. There's also perllol about lists-of-lists (nested references).

    You can open the documentation using perldoc perlreftut, etc.

提交回复
热议问题