DEV Community

Discussion on: Perl Sigil is inherited from Shell Script Variable Expansion.

Collapse
 
emilper profile image
Emil Perhinschi

Perl's "sigils" are dereference operators , not true sigils ; BASIC had sigisl, PHP has sigils, Raku has sigils ... BASH and Perl 5 have dereference operators

if you think of them as dereference operators it is a lot easier to read Perl code

Collapse
 
bbrtj profile image
bbrtj

Partly yes, because $$var in PHP reads: variable with name stored in $var, while in Perl reads: variable which $var refers to.
Partly no, because $var and @var and %var are completely independent variables, and they likely shouldn't if they were dereferencing the same thing I guess.
Also, var itself is a bareword and does not exist as a variable without its sigil and outside of symbol table.

Collapse
 
emilper profile image
Emil Perhinschi

"$var and @var and %var are completely independent variables"

they're not independent in the symbol table

"var itself" would be a subroutine, which is stored in the same symbol table and accessed by using the & "sigil" if you really want to use "&", though the compiler tries subs first when encountering barewords